Home > Back-end >  Can't install gem rmagick
Can't install gem rmagick

Time:10-04

I'm trying to install rmagick on a new mac, running montaray osx 12

I've installed rbenv, bundler etc and now running bundle install i get

Installing rmagick 4.2.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/will/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/rmagick-4.2.4/ext/RMagick
/Users/will/.rbenv/versions/2.7.5/bin/ruby -I /Users/will/.rbenv/versions/2.7.5/lib/ruby/2.7.0 -r
./siteconf20221003-4792-u83yc4.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes


ERROR: Can't install RMagick 4.2.4. Can't find ImageMagick with pkg-config


*** 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
    --without-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/will/.rbenv/versions/2.7.5/bin/$(RUBY_BASE_NAME)

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

  /Users/will/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/rmagick-4.2.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/will/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/rmagick-4.2.4 for
inspection.
Results logged to
/Users/will/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/rmagick-4.2.4/gem_make.out

An error occurred while installing rmagick (4.2.4), and Bundler cannot continue.
Make sure that `gem install rmagick -v '4.2.4' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rmagick

I have installed pkg-config and imagemagick@6 with homebrew

I have followed various SO answers to debug, but nothing is working. How can I install rmagick ?


UPDATE contents of my /Users/will/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/rmagick-4.2.4/mkmf.log file –

find_executable: checking for brew... -------------------- yes

--------------------

assert_minimum_ruby_version!: checking for Ruby version >= 2.3.0... -------------------- yes

--------------------

find_executable: checking for pkg-config... -------------------- yes

--------------------

ERROR: Can't install RMagick 4.2.4. Can't find ImageMagick with pkg-config

CodePudding user response:

There is currently a clash with the homebrew installed "highway"

workaround to get rmagick installed

brew install pkg-config imagemagick
brew  uninstall highway
bundle install
brew install highway

https://github.com/rmagick/rmagick/issues/1153

CodePudding user response:

As per the log:

ERROR: Can't install RMagick 4.2.4. Can't find ImageMagick with pkg-config

You don't have image magick installed. The following command should help.

brew install imagemagick

Install imagemagick and and then try bundle or install the gem manually gem install rmagick -v '4.2.4'

  • Related