Rob Lacey

Brighton, UK - contact@robl.me

Senior Software Engineer working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently looking for new opportunities


ImageMagic not installing on MacOSX

Building RMagick with native extensions is playing up again… I use homebrew so I was looking for the right solution.

Using rexml 3.2.4
Fetching rmagick 2.13.4
Installing rmagick 2.13.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/rl/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rmagick-2.13.4/ext/RMagick
/Users/rl/.rbenv/versions/2.6.6/bin/ruby -I /Users/rl/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20210707-24851-uczhdh.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for clang... yes
checking for Magick-config... no
checking for pkg-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.4. 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
	--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/rl/.rbenv/versions/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/rl/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/rmagick-2.13.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/rl/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rmagick-2.13.4 for inspection.
Results logged to /Users/rl/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/rmagick-2.13.4/gem_make.out

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

Seems need to reset pkg-config.

brew remove imagemagick
brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config && brew link pkg-config
brew install imagemagick
gem install rmagick

Thanks to https://github.com/ttscoff/Slogger/issues/344