How to tell RMagick which ImageMagick too use? [duplicate] - ruby

I am getting following error while running local script/server of my Rails project:
This installation of RMagick was configured with ImageMagick 6.6.1 but ImageMagick 6.4.5 is in use. (RuntimeError)
Running identify --version shows the following:
Version: ImageMagick 6.6.1-10 2010-05-21 Q8 http://www.imagemagick.org
So, my question is how and where should I make changes to work it fine; I have already reinstalled ImageMagick but that didn't work.

the same thing happened to me but the solution was a bit simpler than uninstalling imageMagick. It sounds like Rmagick's config file isn't updated to use your updated imagemagick so try
sudo gem uninstall rmagick
sudo gem install rmagick
restart your server.
I took a closer look and noticed you had Rmagick configured for a newer imageMagick but using an older imageMagick. So I would assume that my solution would still work but you would not be using the newer ImageMagick.

If using bundler:
bundle exec gem uninstall rmagick
bundle install (will reinstall rmagick as part of the bundle)

I would remove any previous installation and start again by following this page.
First of all open a shell and launch:
identify -version
which will give you the IM version installed on your system.
Depending on how You installed IM, find the way to remove It completely from the system. For instance if you used apt-get, try:
sudo apt-get remove ImageMagick
If you installed IM from sources, go to where you have them stored (I mean the sources path/folder) and type:
make uninstall
You can then reinstall ImageMagick, compiling it from the sources:
cd
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxf ImageMagick.tar.gz
cd ImageMagick-*/
./configure --prefix=$HOME --without-perl
make
make install
Then you have to add $HOME/bin to the beginning of your $PATH
cd
echo "export PATH=$HOME/bin:\$PATH" >> .bash_profile
source .bash_profile
Now it's time to gem install RMagick:
export LD_LIBRARY_PATH=$HOME/lib
gem install rmagick

RMAGICK_BYPASS_VERSION_TEST = true
Thats a global flag set before requiring rmagick.
from
https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/565461/comments/2
Worked and tested ok for me.

I made it work by uninstalling and then deleting the file listed in the error message (before reinstalling). It seems that uninstalling doesn't always clean up some of the old ".so" files.

I had the same issue, and eventually concluded that my installation of libmagick9-dev
(sudo apt-get install libmagick9-dev ruby1.8-dev) was installing ImageMagick APIs for the lower version. My solution was to uninstall the later versions and go with the Ubuntu packaged versions of ImageMagick and the other libraries.

I bumped into this on a Rails app. I tried Scott Montgomerie's answer, but I couldn't get bundle exec gem to work (not sure why, no time to find out).
What worked for me was a simple bundle update rmagick.

bundle update rmagick worked for me

Related

Unable to install package using luarocks on osx

I installed lua on my OSX 10.10 machine using brew install lua. The version that got installed was 5.2.4. LuaRocks was installed along with the lua package. But when i run luarocks install <package_name> i get Error: ##HOMEBREW_PREFIX## does not exist and your user does not have write permissions in. i tried using sudo luarocks install <package_name> as well, but it gives the same error. How to fix this ?
Please Help.
Thanks
This was a bug in the way we relocate text files to ensure wider bottle portability for non-/usr/local users.
It was resolved a couple of weeks back, July 31st I believe. Presuming your Homebrew is in a standard location, if you do:
rm /usr/local/etc/luarocks52/config-5.2.lua && brew update && brew reinstall lua
The problem should be resolved now. Apologies!
I had the same problem when using the luarocks when installed with homebrew, try installing luarocks again like this:
$ wget http://luarocks.org/releases/luarocks-2.2.1.tar.gz
$ tar zxpf luarocks-2.2.1.tar.gz
$ cd luarocks-2.2.1
$ ./configure; sudo make bootstrap
I took this code snippet from here: https://luarocks.org/
I managed to install all the modules that I required without problems after doing this.

Reinstalling rubygems

How do you reinstall RubyGems as mentioned in no such file to load -- rubygems (LoadError)?
Running Mac OS X 10.8.2
Download it right from the source.
I had massive trouble trying to get gem update --system or gem install rubygems-update working properly.
The only thing that worked was downloading right from the source and just overwriting your old version of RubyGems.
Simply download the latest here (was 2.0.3 at time of writing).
Extract the downloaded archive and cd into the resulting directory.
Run the setup with ruby setup.rb. (You may need to use sudo for this, but try it without first.)
All good!
JP
Download the latest version:
wget http://...
unpack the file:
tar xzvf ruby-...
and install it:
cd ruby-...
./configure
make
make install
For control, ruby --version

Installing RMagick gem -- Can't find MagickWand.h

I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick, and I am getting the following error
Can't install RMagick 2.13.1. 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/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
Gem files will remain installed in /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Looking in the mkmf.log file I see
have_header: checking for wand/MagickWand.h... -------------------- no
"/usr/bin/gcc-4.2 -E -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. conftest.c -o conftest.i"
conftest.c:3:29: error: wand/MagickWand.h: No such file or directory
It's true. The file MagickWand.h is not found in any of the directories specific by the -I directives of the gcc-4.2 command. Why not? And how can I fix this?
ImageMagick is installed, using homebrew. If I search my drive I find MagicWand.h installed in /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h.
I've tried all the suggestions in Can't install RMagick 2.13.1. Can't find MagickWand.h., but none of them have worked.
Edit:
Another thing to note: I originally had ImagMagick 6.7.0-7 installed using MacPorts, and RMagick installed just fine. Except that it would not work with the CarrierWave gem. So I uninstalled MacPorts and uninstalled RMagick. Then reinstalled ImageMagick using brew install -f imagemagick --disable-openmp, and attempted to reinstall the rmagick gem (which brings me to my current problem). I restarted all terminals at each step, to ensure that my paths were refreshed.
For Debian-based (e.g., Ubuntu) systems you can try,
sudo apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick
it works for me.
found solution from ruby-forum
1) install by installer
http://cactuslab.com/imagemagick/
2) try gem install rmagick
if checking for wand/MagickWand.h... no
type
mdfind MagickWand.h
find some thing like
/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h
and type in terminal
C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick
if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."
type
mdfind MagickCore.pc
find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
and finally in terminal type:
PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Turns out the answer was in Can't install RMagick 2.13.1. Can't find MagickWand.h. after all. I had just followed the suggestion incorrectly.
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick
This installed rmagick gem successfully.
Unfortunately, rmagic is still not working with CarrierWave :-(, but that is a different problem altogether.
Here's a solution for OS X Mavericks - at least it worked for me...
First, install Xcode 5 (from the App Store)
Then install development-tools - open Terminal and type:
xcode-select install
Next, grab the ImageMagick package from CatusLab: http://cactuslab.com/imagemagick/
(I opted for the package without Freetype support, that requires XQuarz - but it's really up to you).
You'll need pgkconfg as well - get it here: http://macpkg.sourceforge.net
Once installed, export the pkgconfig binary:
export PATH=/opt/pkgconfig/bin:$PATH
Then find the MagickWand.h
mdfind MagickWand.h
it puts out the path to MagickWand.h, in my case /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h
Next find the pkgconfig path:
mdfind MagickCore.pc
For me it put out: /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
I had the problem that rmagick gem couldn't be fetched so I downloaded it from rubygems.org/gems/rmagick
With the rmagick gem downloaded to your Download folder you should now be able to install rmagick:
sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install --local ~/Downloads/rmagick-2.13.2
For me it installed successfully - hope this helps...
I wasted a lot of time on this, ImageMagick versions above 6.7 don't play nicely with the installation of the rmagick gem. It looks like someone made a package to address this issue, try:
brew install imagemagick-ruby186
After uninstalling your previous imagemagick. Afterwards gem install rmagick worked fine for me.
I am on OS X El Capitan.
My app is using ruby 2.1.2 and rmagick 2.13.4.
When using brew install imagemagick I get ImageMagick -v 7.0.4-5.
The solution for me was to use brew install imagemagick#6 which gave me ImageMagick -v 6.9.7-5 which allowed me to successfully install the gem.
here's what i did on 16.04.1,
sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat
and then install gem
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'
I had a similar issue with running
$ gem install rmagick
then check the version by typing
$ convert --version
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install I exported the imagemagick path by adding
$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
to my ~/.bash_profile, sourcing the new profile, then running gem install rmagick again.
this worked for me try
if the above solution doesnt work then try following command
sudo apt-get install libmagickwand-dev
this will help i hope.
The only thing that worked for me on OSX El Capitan (10.11.6) was cloning this repository:
https://github.com/zagros/imagemagick-rmagic-el-captian
And following compile steps for each library described on that github page, but with slight modification.
The imagemagick itself in stuff folder is already compiled and lacks configure script, so I took other image magick from stuff sierra extracted it and compiled, installed and after that gem install rmagick worked.

Error Installing Jekyll - Native Extension Build

I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link. I think it's an update to Ruby, but RVM is having trouble installing alternate versions of ruby as well.
Heres the full post:
$ sudo gem install jekyll
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out
Does this mean I need to update the version of ruby I'm using via rvm?
Ubuntu
sudo apt-get install ruby-dev
gem install jekyll
Your problem is that either you system doesn't know where make is located at or you don't have it installed. The easiest way to fix this (and probably other issues you'll run into trying to get a ruby system up and running) is to install xcode.
You can get it at http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12 for lion. Or it came on a CD with your computer for earlier versions.
If you're using Lion, please see comments below for a link to how to install developer tools on Lion.
I had the same error on Ubuntu and this helped me sort it out.
You must have ruby-dev installed
apt-get install ruby-dev
If you installed XCode and command line tools are still missing go to Terminal and
xcode-select --install
it will prompt you to install these tools. After that just follow SrBlanco´s answer. That solved the problem for me.
Good luck.
Need to install "make".
I am using Ubuntu 12.10.
sudo apt-get install make
Should work on any Debian based distro.
Note: this problem also occurs on newer MacBook Pro models that come with Mavericks pre-installed. I updated another post with my own solution that didn't involve Xcode at all. My system had the Xcode developer tools installed when I got the machine.
ERROR: Error installing jekyll: ERROR: Failed to build gem native extension
Install Xcode as mentioned if you don't have it installed already (https://developer.apple.com/xcode/). Plus you need the command line tools.
Open Xcode. Go to Preferences > Downloads > Install Command Line Tools
Installing command line tools for Xcode solved the problem for me on my Mac
xcode-select --install.
sudo apt-get install ruby-dev
sudo gem install jekyll
hope this will help, it works with me.
I had this same exact error when trying to install Jekyll, and the following steps from this link helped me. Just in case anyone else comes across this!
http://davidensinger.com/2013/03/installing-jekyll/
I was facing the same issue in my Fedora 22 setup. I had ruby installed but didn't have ruby-devel. Installing ruby-devel fixed the issue for me.
dnf install -y ruby-devel
For older systems:
yum install -y ruby-devel
I followed this on Ubuntu/Linux Mint
sudo apt install build-essential
sudo apt install ruby-dev
sudo gem install jekyll
An addendum: You can install XCode now from the App Store on Mountain Lion. The process is transparent and pretty fast.
I had the same problems with you.
I use Mac OS X 10.9 develop preview version, and I had installed gcc and Xcode.
But my Xcode version is 4.6.
Then I install the Xcode 5.0
After that I type sudo gem install jekyll in the terminal again. Then it works.
Wish it could help someone.
Installing Xcode and going to perferencs > downloads > install commandline tools WORKS!
Same problem on Debian, I had forgot to run this command:
~/.rvm/scripts/rvm
All these answers did NOT work for me.
If you're looking for a solution on ubuntu 14.04, do this:
sudo apt-get install ruby1.9.1-dev zlib1g-dev nodejs
sudo gem install jekyll -v 2.5.3
Unfortunately, nodejs is required because of a bug in Jekyll that enforces existence of runtime JS engine even though it doesn't need one.
For Ubuntu, this helped in my case:
apt-get install libffi-dev
A general advice is to just follow what is displayed as the reason for the error and hopefully you'll be provided with a log file in which the first line suggests which package should be installed, in my case:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.21/mkmf.log
MacOS
my solution to this problem
install xcode
type xcode-select --install in the command line
type sudo gem install jekyll in the command line
PS: It is the combination of the two answers in this question.
You are missing the ruby-dev file , just go ahead and run this command - sudo apt-get install ruby-dev
Hope this helps!!
I had the same issue on my macOS(10.14.2), the reason may be:
Apparently with OSX el Capitan, there is a new security function that prevents you from modifying system files called Rootless.
My solution is using rvm:
install ruby on Mac OS X with RVM
gem install jekyll
On windows I have this issue
I actually installed the version rubyinstaller-devkit-2.6.3-1-x64 of ruby
I have removed the ruby completely and Installed the rubyinstaller-devkit-2.5.5-1-x64
and issued the following commands on powershell
gem install bundler
gem install jekyll
and this time no errors where found
I had this issue and of all things, the error was occurring because I hadn't agreed to some updated terms of service in xcode. Running the following did the trick for me. Go figure.
sudo xcodebuild -license accept
For me, I had to upgrade homebrew and install rbenv to the latest ruby version. After that, I followed the instruction at jekyll website. My OS is Catalina 2019, I couldn't install Xcode, which is not compatible yet!
You have to set the path in your .bash_profile to make sure that it initializes the rbenv when you restart your terminal.
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
then
$ rbenv version
2.2.3 (set by /Users/mislav/.rbenv/version)
$ rbenv shell
rbenv: no shell-specific version configured
hope that help!
Here is the (only?) reliable and simple way to install Jekyll on macOS
Install UTM
Install Ubuntu Server
Install Jekyll using Ubuntu instructions at https://jekyllrb.com/docs/installation/ubuntu/
Forward port 22 in the VM settings (22->localhost->22)
Use VS Code on the macOS host
Install Remote SSH
Connect to USER#localhost
Drag and drop the folder on Mac into VS Code (this transfers files to remote)
Enable port forwarding for 4000 (bottom bar on VS Code)
Work on your website
Right click on your website on the file explorer and click download
If you have not done these steps, you might be delighted by:
Ubuntu imports your public SSH key from GitHub
VS Code magically handles file transfer in and out
VS Code magically installs your VS Code extensions onto the remote server and allows file search on the remote host

Can't install RMagick 2.13.1. Can't find MagickWand.h.

When I try do install rmagick I get the following error message:
Can't install RMagick 2.13.1. 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.
I'm on Mac OSX 10.6.8, ruby 1.9.2p290, rvm 1.10.2.
Can anyone help me please to solve this problem.
If you're on Ubuntu, installing this package is what fixed it for me:
sudo apt-get install libmagickwand-dev
It looks like ImageMagick 7 changed include file path.
On building rmagick, since it includes file as wand/MagickWand.h There are no workarounds. It looks like sticking with ImageMagick 6 for now.
On Mac OS X (I tested on Sierra), I used HomeBrew's versions tap like:
brew tap homebrew/versions
brew install imagemagick#6
Then, use the path shown on above installation:
PKG_CONFIG_PATH=/usr/local/opt/imagemagick#6/lib/pkgconfig gem install rmagick
To install with ImageMagick 6.
I didn't want to mess with environment variables since I wanted bundler to be able to compile this gem on its own on a CI machine. Instead, I used Homebrew to install pkg-config:
brew install pkgconfig
and the next time I tried compiling the RMagick gem it found the header file without issue.
(This is pkg-config 0.28, ImageMagick 6.8.0-10, and RMagick 2.13.2, all on Mountain Lion.)
I had a similar issue with running
$ gem install rmagick
First of all, do you have imagemagick installed? If you're not sure, run
$ convert --version
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading
https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install
I exported the imagemagick path by adding
$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
to my ~/.bash_profile, sourcing the new profile, then running:
gem install rmagick
It worked for me after I did this.
fix this setting the include path of your current imagemagick installation:
Install ImageMagick with brew
brew install imagemagick
find library
$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h
Install rmagick gem
$ C_INCLUDE_PATH=/path/MagickWand.h gem install rmagick
example:
$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick
I marked this as a favorite because it seems to come back to bite me with every new system I need to install RMagick on (and time has passed and version numbers have rolled).
Mac OS X 10.8.4
rvm 1.22.3
ruby-2.0.0-p247
Xcode 4.6.3 developer tools installed
$ brew install imagemagick
==> /usr/local/Cellar/imagemagick/6.8.6-3
$ brew install pkgconfig
==> /usr/local/Cellar/pkg-config/0.28
$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/lib/pkgconfig/ gem install rmagick
Successfully installed rmagick-2.13.2
Many thanks to everyone who added helpful answers above!
Mac users using brew
If you can use v6 of ImageMagick instead of 7, you can try this
brew install imagemagick#6 --force && brew link imagemagick#6 --force
Note this will unlink your existing IM installation, so be careful if you have other projects on your machine using ImageMagick without problems.
For my own and others edification, I got past the error about the magicwand.h by using the suggestion xonico. MDFind plus the C_INCLUDE_PATH. However, it then gave me an error about MagickCore.pc. My final command to get this working had to include both like so:
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick
Obviously your paths will vary depending on whether you're using brew like me and what version of imagemagick you were installing. Also, xcode command line tools did have to be installed, as others have mentioned.
Thanks for everyone's posts on this! I am plussing your answers since it contributed to mine!
For Ubuntu:
sudo apt-get install imagemagick libmagickwand-dev
gem install rmagick
I had a problem after update to Maverics.
It have lost a lot of linkings.
In my case I had to refresh links to pkg-config
brew unlink pkg-config
brew link pkg-config
Then installing rmagick worked like a charm.
I updated to Mountain Lion and started getting this same problem. I had to re-install brew, XCode, the XCode tools - pretty much the whole environment!
I eventually solved this problem using the answer from phopkins above...
brew install pkgconfig
Once that was successfully completed (I had to delete some old symlinks first) then I was able to successfully install the RMagick gem
This worked for me on Mac OsX
Install Imagemagick:
brew remove imagemagick
brew install imagemagick
Make sure pkg-config is correctly linked:
brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config && brew link pkg-config
Install gem
gem install rmagick
For Ubuntu users:
It will never done directly on Ubuntu. You should first install packages to run this command...:
sudo apt-get install libmagickwand-dev
...and then do install:
gem install rmagick
You may get the same issue, for that, Try clearing your apt repository and removing any broken packages first:
sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
If the system identifies any broken packages, forcefully remove them (replace package_name with your own):
sudo dpkg --remove -force --force-remove-reinstreq package_name
Then re-install any missing packages again. :)
An issue for me was that rmagick is out of date and not updated regularly. If you have too new of an ImageMagick version, then it might not be compatible. Check your version of ImageMagick using the following:
$ convert --version
If the ImageMagick version is > 7, it is not compatable with rmagick. The user will get errors such as
Can't install RMagick 2.16.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Go back to version six of ImageMagick until they update rmagick to be compatible with version seven of ImageMagick. Someone has hosted the appropriate version(6) in a separate gem - 'imagemagick#6'.
If you need rmagick to work but currently have an imagemagick version 7 or higher, here are the steps to switch:
$ gem install imagemagick#6
$ brew unlink imagemagick
$ brew link imagemagick#6 --force
Helped me on Debian Wheezy 64bit
apt-get install libmagickcore-dev libmagickwand-dev
Try reinstalling both Imagemagick and PkgConfig. That should fix it for Mavericks
brew update && brew upgrade
brew reinstall imagemagick
brew reinstall pkgconfig
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick
I was really struggling with this on OS X Mountain Lion (after upgrading from Lion) and none of the suggestions regarding C_INCLUDE_PATH, PKG_CONFIG_PATH, ln'ing various files, etc., were working. On the same day I upgraded to Mountain Lion, I also upgraded XCode to 4.5.2, but I didn't really think too much of this.
Eventually I stopped trying to install RMagick and had to pass on the work to a colleague.
Then, by chance, I found that I was trying to use bundle install on another project and I wasn't able to install the json gem because "make" could not be found. I checked into that and found you need to go to XCode -> Preferences -> Downloads and install the command line tools to get make working again. The json gem installed fine.
Then I paused...and tried
gem install rmagick
One more time. It worked perfectly.
for a rails based application, I found this
sudo apt-get install -y libmagickwand-6-headers
C_INCLUDE_PATH=/usr/include/ImageMagick-6 gem install rmagick
bundle update rmagick
bundle install
worked on debian jessie
I ran into this because I'd run OS X's Migration Assistant and nothing was relinked after the migration. You need to check the output of Wand-config --ldflags --libs. In my case it gave:
$ Wand-config --ldflags --libs
/usr/local/bin/Wand-config: line 50: pkg-config: command not found
/usr/local/bin/Wand-config: line 53: pkg-config: command not found
After relinking pkg-config, libpng, and libfreetype, that became:
$ Wand-config --ldflags --libs
-L/usr/local/Cellar/imagemagick/6.8.8-9/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
-L/usr/local/Cellar/imagemagick/6.8.8-9/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16
And then:
$ gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
Parsing documentation for rmagick-2.13.2
Done installing documentation for rmagick after 4 seconds
1 gem installed
In linux OS:
C_INCLUDE_PATH=/usr/local/include/ImageMagick-6/ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/vagrant/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
...
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
then:
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
in my .bashrc file to pick up MagickCore.pc, then created two symlinks:
ln -s /usr/local/include/ImageMagick/wand /usr/local/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/local/include/ImageMagick-6/magick
Now:
$ gem install rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
boom everything works fine.
At arch linux, after installing imagemagick#6, gem wasn't able to install package rmagick and got error below.
Can't install RMagick 2.16.0. Can't find MagickWand.h
Worked for me using below steps
added pkgconfig path to .bashrc
export PKG_CONFIG_PATH="/usr/lib/imagemagick6/pkgconfig"
Created two symlinks as below
ln -s /usr/include/ImageMagick-6/wand /usr/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/include/ImageMagick-6/magick
There are some variants to this problem. Mostly the case is dealing with a legacy application that run older versions of ruby.
rmagick has a dependancy on imagemagick... but not just any. If you've gone too far ahead, it may be wise to backtrack:
brew uninstall imagemagick
Then proceed with an appropriate version
brew install imagemagick#6
then you path needs to be adjusted and forced upon homebrew
export PATH="/usr/local/opt/imagemagick#6/bin:$PATH"
brew link --force imagemagick#6
then you can install rmagick to most recent or versioned
gem install rmagick -v '2.15.4' --source 'https://rubygems.org/'
I had a hard time getting this same issue to work when I had a default ImageMagick install on OSX 10.8 (no homebrew or macports). No combination of the suggestions in this thread or threads linked to from this thread worked for me (modifying the paths for my local install of course).
I simply deleted the default ImageMagick 6 install, and then reinstalled with macports. My rmagick install worked immediately after with no other changes.
on OSX Maverick 10.9.1
it took me ages to figure it out but I solved these issues the following way:
nano /etc/paths
changed:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
into:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
that that local stuff, like 'brew' is loaded first.
now I hit 'brew doctor' into the terminal, to see if there's something messed up
if you get the following output
Your system is ready to brew.
everthing is fine. if not ti will tell you what to do. Like kick out unbrewed stuff, broken libs, clean symlinks and whatnot.
When you are ready to brew, you need ghostscript(for pdfs), libpng, imagemagick via brew.
then you can happily type : 'gem install rmagick', in case you did't kill your ruby setup. But thats easy to reinstall via your cleaned up brew.
PS:
another helpful command is: 'which convert', to show you what version of imagemagick is used by the system.
as well as --version
so if you installed git via brew and do 'git --version' and it returns some apple git version, your load path is broken...
On Mac OS X 10.9, try to update your Xcode if there's a warning about it.
$ brew doctor
I you found some warning, do:
$ sudo /Developer/Library/uninstall-developer-folder
Then try:
$ bundle install
again
That worked fine for me.
On CentOS 6.5 x64, it was pretty easy:
yum install ImageMagick ImageMagick-devel
gem install rmagick -v '2.13.2'
I was able to fix this by upgrading to 2.13.2
All brew options failed to install rmagick 2.13.1 on yosemite 10.10
this worked
get the latest RVM
\curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.1.1
rvm use 2.1.1
download and install the package file
http://cactuslab.com/imagemagick
(I used pacifist to install)
Confirm location of MagickCore.pc file
mdfind magickcore.pc
eg. /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
Manually download rmagick-2.15.2.gem file
https://rubygems.org/gems/rmagick/versions/2.15.2
from that dir
sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig gem install --local rmagick-2.15.2.gem
If you are having issues with bundle installer still complaining about 2.13.1
In your gem file / gem.lock file upgrade ALL dependencies
rmagick (2.13.1) - > rmagick (>= 2.15.2)
Got same error for alpine 3.9 image build. It comes with ImageMagick 7.0.8.38-r0
To fix that you either use alpine 3.5 with ImageMagick 6.9.6.8-r1:
FROM alpine:3.5
Or install ImageMagick 6.9.6.8-r1 with package repository for 3.5:
RUN apk add imagemagick-dev=6.9.6.8-r1 --repository http://dl-3.alpinelinux.org/alpine/v3.5/main/
There is an open issue in rmagick repo regarding failed builds for ImageMagick 7.0.x. so hopefully it will be fixed soon.

Resources