An error occurred while running bundle install

72 views Asked by At

I saw post like this and tried advice there but problem still exists so posting here again. Thanks in advance!

when I run DEPENDENCIES_NEXT=0 bundle install I got following error:

Can't install RMagick 2.16.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/xxxxxxxxxxxx/.rvm/rubies/ruby-2.6.6/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/extensions/-darwin-22/2.6.0/rmagick-2.16.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/gems/rmagick-2.16.0 for inspection.
Results logged to /Users/xxxxxxxxxxxx/.rvm/gems/ruby-2.6.6@yyyyyyyyy/extensions/-darwin-22/2.6.0/rmagick-2.16.0/gem_make.out
......
.....

An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.

In Gemfile:
  gruff was resolved to 0.7.0, which depends on
    rmagick

I tried reinstall and relink image, and those were executed successfully:

yyyyyyyyy@bcd074b3401b xxxxxx % brew unlink imagemagick@6
Unlinking /opt/homebrew/Cellar/imagemagick@6/6.9.13-4... 0 symlinks removed.
yyyyyyyyy@bcd074b3401b xxxxxx % brew link --force imagemagick@6

Linking /opt/homebrew/Cellar/imagemagick@6/6.9.13-4... 76 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

gem install rmagick installed rmagick-5.3.0 successfully but which doesn't help.

I think the root cause is that somehow gem's installation is default for rmagick-5.3.0, and when I try to install 2.16.0, I saw exact same error message of bundle. gem's version is 3.0.9

I'm onMacOS Ventura M1 Pro

1

There are 1 answers

0
JCBC On

I just had the same problem after updating to macOS Sonoma. Here are the steps that worked for my Rails app that needs RMagick 2.16.0:

  • brew install --build-from-source imagemagick@6
  • I did the suggestions that were listed after the successful install:

If you need to have imagemagick@6 first in your PATH, run: echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

For compilers to find imagemagick@6 you may need to set: export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib" export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"

For pkg-config to find imagemagick@6 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"

  • gem install rmagick --version 2.16.0

  • bundle install

Your mileage may vary as there are a couple of differences between our setups:

  1. You are on macOS Ventura. I am on macOS Sonoma 14.2.1.
  2. You are using ruby-2.6.6. My app uses ruby-2.4.1 (through rvm).