rmagick gem install "Can't find Magick-config"
Solution 1
When building native Ruby gems, sometimes you'll get an error containing "ruby extconf.rb". This is often caused by missing development libraries for the gem you're installing, or even Ruby itself.
Do you have apt
installed on your machine? If not, I'd recommend installing it, because it's a quick and easy way to get a lot of development libraries.
If you see people suggest installing "libmagick9-dev", that's an apt package that you'd install with:
$ sudo apt-get install libmagickwand-dev imagemagick
or on centOs:
$ yum install ImageMagick-devel
On Mac OS, you can use Homebrew:
$ brew install imagemagick
Solution 2
The new correct way is to install libmagickwand-dev:
sudo apt-get install libmagickwand-dev
Then you should be able to install rmagick no problem.
Solution 3
imagemagick@6 works for me!
brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force
See this thread
Solution 4
Ubuntu 15.10
Note that if you try to install this gem in ubuntu 15.10, then error can happened:
Can't install RMagick 2.13.1. Can't find Magick-config in ...
All you need is preload PATH variable with additional path to ImageMagick lib.
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
then run gem install rmagick
Solution 5
UPDATE If you're a Mac/OS X user I would HIGHLY recommend using Homebrew as your package installer/manager. You can find it HERE. Since originally asking this question I have removed all my prior installs of things like rmagick and imagemagick, and reinstalled them using Homebrew. Super easy with a huge catalog of packages, and updates/uninstalls are a cinch as well!
I finally got it working by utilizing a script for ImageMagick installation on github.
magick-installer ( https://github.com/maddox/magick-installer )
It made a fresh install of ImageMagick, and the RMagick 2.12.2 gem then installed perfectly via bundler.
Thanks to Hulihan Applications for confirming that it was most likely a missing library. I tried the suggestion of using apt-get by installing the package downloader from Fink Project. I ran the following command in terminal, but it couldn't find the libmagick9-dev libary.
$ sudo apt-get install libmagick9-dev
$ Password:
$ Reading Package Lists... Done
$ Building Dependency Tree... Done
$ E: Couldn't find package libmagick9-dev
I need to bone up on my UNIX command line skills. The original copy of ImageMagick that I installed from source is still on the machine, but I don't know where exactly or how to remove it. So much to learn...!
Joe
Updated on August 25, 2021Comments
-
Joe over 2 years
I get the error shown below when attempting to install the rmagick gem. I am on Snowleopard 10.6 using RVM, Ruby 1.9.2-head and Rails 3.05. Responses to similar questions recommended installing ImageMagick, which I successfully did. Other suggested installing the "libmagick9-dev library", however, I can not figure out how to do this.
I'm a new developer, and any assistance or directions to an existing explanation or resource is greatly appreciated. Thanks!
jjdevenuta(opal)$ gem install rmagick Fetching: rmagick-2.13.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.13.1. Can't find Magick-config in /Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@rails3/bin:/Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin:/Users/jjdevenuta/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin *** 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/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin/ruby
UPDATE If you're a Mac/OS X user I would HIGHLY recommend using Homebrew as your package installer/manager. You can find it HERE. Since originally asking this question I have removed all my prior installs of things like rmagick and imagemagick, and reinstalled them using Homebrew. Super easy with a huge catalog of packages, and updates/uninstalls are a cinch as well!
-
Brandon Frohbieter about 13 yearsare you using fink, macports, or homebrew?
-
Joe about 13 yearsI have macports, but used the binary download for snow leopard on the imagemagick site. I can't find anywhere to download/install from for the libmagick9-dev.
-
Jonathan almost 12 yearsIf you update the best answer to @Travis R 's answer would be good
-
jstreebin about 11 yearsBrew didn't work for me so I used the magick-installer (github.com/maddox/magick-installer) and it worked perfect.
-
Marcin Rudzki almost 11 yearsFor Ubuntu ver. >= 12 Solution is in: stackoverflow.com/questions/16093006/…
-
eaykin over 10 yearsYou can check my earlier answer to the same problem and relevant discussions at: stackoverflow.com/a/4178174/143179
-
givanse over 10 yearsIt is a duplicate of Can't find Magick-config
-
eaykin about 10 yearspossible duplicate of ImageMagick / RMagick - Can't install RMagick 2.13.1. Can't find Magick-config
-
-
Joe about 13 yearsI successfully installed apt-get via the fink project as you suggested (Thanks). However, apt-can't seem to find the package. "sudo apt-get install libmagick9-dev Reading Package Lists... Done Building Dependency Tree... Done E: Couldn't find package libmagick9-dev" - I'm at a lost now.
-
Govind N almost 13 yearsI was getting "Can't install RMagick 2.12.2. Can't find Magick-config in..." on Ubuntu 11.04. This fixed it. Thanks!
-
James P McGrath over 12 yearsI too was getting "Can't find Magick-config" on (Mint) Linux and installing the libmagick++-dev made the problem go away. Thanks!
-
mahemoff about 12 yearsI had this problem and couldn't install libmagick9-dev due to some weird depdendency issues (askubuntu.com/questions/112548/rmagick-install-problem). I was able to install RMagick in the end with apt-get install imagemagick libmagickwand-dev.
-
Sean H about 12 yearsTHANK YOU. This was a lifesaver.
-
Jonathan almost 12 yearsThank you this worked for me, after installed I just ran
bundle install
rather than trying to dosudo gem install rmagick
-
Brad Mace almost 12 yearson CentOS I needed
yum install ImageMagick-devel
-
vinod over 11 yearsWorked for me on Ubuntu 12.04 LTS. Thanks.
-
Drew Stephens over 11 yearsOn Ubuntu 12.04 (Precise Pangolin) I used the answer that @TravisR provided, specifying the package
libmagickwand-dev
-
Fredrik Andersson over 11 yearsI second James P McGrath for Debian 6.
-
OmnipotentEntity over 11 yearsPackage libmagick9-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it:
graphicsmagick-libmagick-dev-compat
<<< Installing this package worked for me. -
jstreebin about 11 yearsafter hours trying every comment on the web about this, the magick-installer worked (link above) on mac!
-
jstreebin about 11 yearsI tried this but ultimately the magick-installer below worked for me on mac
-
elboletaire about 11 yearsJust installing
libmagickcore-dev
andlibmagickwand-dev
worked for me on Ubuntu 12.10. In fact, trying to installgraphicsmagick-libmagick-dev-compat
throws an error for me. -
wuliwong over 10 yearsOn Ubuntu 13.04 I also installed
libmagickwand-dev
to getrmagick-2.13.2
to install. -
Kelsin over 10 yearsWhen doing this on my ubuntu 12.10 install I followed another answer and Ubuntu suggested a package that replaced libmagick9-dev. That package was not compatible. The one listed in this answer is.
-
jmontross over 10 yearsPlease edit with sudo apt-get install libmagickwand-dev for your ubuntu instructions
-
Marnen Laibow-Koser about 10 yearsFink is kind of outdated; I wouldn't recommend using it anymore. And as others have said, Homebrew is a better Mac package manager than Fink ever was.
-
dhulihan about 10 yearsI've removed the reference to fink in the answer.
-
Tomanow over 9 yearsOn homebrew, you may need to run
brew link --overwrite imagemagick
after install. -
Sandro L over 9 yearsWorks on Ubuntu 14.04 LTS. Thank you, sir!
-
Admin almost 9 yearsWorks on Debian 7.8 as well. Thank you!
-
carlosveucv over 8 yearsNot only did I need libmagickwand-dev, but also imagemagick So I had to run:
sudo apt-get install imagemagick libmagickwand-dev
-
mltsy over 7 yearsIf you are working on a project with an older version of rmagick (i.e. 2.13), you may have to
bundle update rmagick
for it to work with the new versions of imagemagick. That is what worked for me (and if rmagick is locked at a lower version, you may have to update your Gemfile and/or app to upgrade it to a newer version) There are a few other suggestions at this thread regarding backwards compatibility issues: github.com/rmagick/rmagick/issues/201#issuecomment-106765516 -
Muhammad Faisal Iqbal over 7 yearsI tried this on Ubuntu 16.04 but says "libmagickwand-dev : Depends: libmagickwand-6.q16-dev but it is not going to be installed"
-
Muhammad Faisal Iqbal over 7 yearstried on ubuntu 16.04 but says "libmagickcore-dev : Depends: libmagickcore-6.q16-dev but it is not going to be installed "
-
Admin almost 7 yearsI'm also in 2017, and after days, something finally works for me.
-
mayorsanmayor about 6 yearsthis worked for me in April 2018, and then this if experience any other problem - stackoverflow.com/a/48666276/5012862
-
Kadarach over 5 yearsWorked for me in 2018 as well.
-
Kulgar over 5 yearsAnd on Ubuntu 18.04 :)
-
crice1988 almost 4 yearsYou saved my bacon with this one. Thanks a million!
-
devjme almost 3 years2021 this is what worked for me on Big Sur!