Installing ImagMagick and rmagick gem in CentOS - ruby-on-rails

I know this has been asked several times, but the problem is they bring in new versions of rmagick and the older methods are not applicable now.
Server - CentOS release 5.6 (Final)
Ruby - ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]
Rails - 2.3.5
I tried to install rmagick gem through these steps. I was root user when I executed these queries:
yum install ImageMagick.i386
yum install ImageMagick-c++-devel.i386
gem install rmagick
The first 2 commands executed smoothly without any errors. On gem install rmagick, I am getting this error:
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
Warning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.
Found partial installation at: /usr
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.1. You must have ImageMagick 6.4.9 or later.
My question is how can I install a version > 6.4.9 of ImageMagick. Isnt yum install supposed to install latest version of ImageMagick? or should I try an older version of rmagickgem? In that case, does any one know the older version numbers of rmagick gem?

The version of ImageMagick in the CentOS yum repo is outdated. This kind person has provided updated packages: Problem installing RMagick rubygem on Centos 5

you must be root. just run
yum -y install ImageMagick-perl

Related

ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config, WSL2 Ubuntu

I'm attempting to update a rails project to use rmagick 4.2.6. Running bundle update gives me the error ERROR: Can't install RMagick 4.2.6. Can't find ImageMagick with pkg-config
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/lafe/.rvm/gems/ruby-3.1.0/gems/rmagick-4.2.6/ext/RMagick
/home/lafe/.rvm/rubies/ruby-3.1.0/bin/ruby -I /home/lafe/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0 -r
./siteconf20220831-171-c6yokv.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.6. Can't find ImageMagick with pkg-config
I believe I have imagemagick installed as running convert logo: logo.gif will generate a gif file.
I also believe the library is linked to pkg-config, as running pkg-config --modversion ImageMagick will output 7.1.0
Running echo $PKG_CONFIG_PATH will return nothing, however if I append the path to include the directory of the ImageMagick.pc file, I still end up with the same error
My os is listed as Ubuntu 20.04 LTS on Windows 10 x86_64 in neofetch, and I'm running it through WSL on windows 11

How to install rmagick on Mac OS X Mountain Lion?

I'm trying to install rmagick on Mountain Lion.
I've installed ImageMagick successfully by Homebrew, but I can't install rmagick gem.
My ruby environment is managed by rvm and installed ruby 1.8.6.
I've got an error below when tried to install rmagick.
gem install rmagick -v 2.7.2
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/Macmini/.rvm/rubies/ruby-1.8.6-p420/bin/ruby extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for magick/MagickCore.h... no
Can't install RMagick 2.7.2. Can't find MagickCore.h.
The erros shows that counldn't find MagickCore.h, but I found in /usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6/magick/MagickCore.h
I guess if I can manage to tell installer this path, it will go well but I've no idea to do it.
I've googled and found similar questions below.
Can't install rmagick in Mountain Lion
"rmagick" gem installation issue
And tried to pass PKG_CONFIG_PATH and C_INCLUDE_PATH before 'gem install' command, and wrote them to ~/.bash_profie, and build ImageMagick from source, but nothing changed.
Does anyone know how to fix it?
Here you'll find the answer. I had the same issue and this solved perfectly!
Rails and OS X: How to install rmagick?
rmagick has a problem working with imagemagick (>= 6.8.0-10) from homebrew.
You can either
update rmagick gem by
bundle update rmagick
or manually symbol link some dylib to make it work:
$ cd "`Magick-config --prefix`lib"
$ ln -s libMagick++-Q16.7.dylib libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
After that gem install rmagick should work.

RMagick install error

all! I have a problem when installing rmagick gem on CentOS 5.5 server. When I issued command:
gem install rmagick
I got:
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 /usr/bin:/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.
I have installed imagemagick with correct version, and I find Magick-config in /usr/local/bin and my PATH includes that dir. However, the rmagick gem installer just does not search that dir for Magick-config. What should I do?
By the way, I have another CentOS 5 machine installing ruby and rmagick successfully, and the latter has the Magick-config file in /usr/local/bin, too.
did you installed Imagemagick? eg:
yum install gcc gcc-c++ ImageMagick-devel ghostscript freetype-devel \
libjpeg-devel libpng-devel libpng10-devel libwmf-devel libexif-devel \
libtiff-devel
See this brilliant post on how to fix it. Just skip the last 3 lines as they are PHP related.
http://codercake.com/installing-imagemagick-6-6-9-7-and-imagick-for-php-on-centos-5-5-64-bit/#comment-39
here the commend which I was used in my command prompt. Please check the version
gem install rmagick -v '2.13.1' --platform=ruby -- --with-opt-lib=C:/ImageMagick-6.8.7-Q8/lib --with-opt-include=C:/ImageMagick-6.8.7-Q8/include
On Mac High Sierra - 10.13.4 - https://www.imagemagick.org/script/download.php
sudo port install ImageMagick
sudo gem install rmagick

Why do I get a bcrypt-ruby gem install error?

Getting an error when trying to install the gem devise, the installation is stopping on
the gem bcrypt-ruby:
$ gem install bcrypt-ruby
Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
I'm running OSX 10.6.7 with Ruby under RVM.
I reinstalled the lastest version of xcode & reinstalled Ruby 64bit, Rails and all the gems.
I had the same problem installing under OSX 10.7.3. When installing the gem, my error message was:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
creating Makefile
make
compiling bcrypt_ext.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [bcrypt_ext.o] Error 1
Looks like the gem is looking for gcc-4.2 but I only had a file called gcc. Now since I had just installed the latest Xcode (4.3), I knew that my C compiler was compliant but the gem had gcc-4.2 hardcoded into it. So my solution was:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
The linking worked like a charm.
Looks like there might be some info missing here - for me, this was due to a brew install of gcc. gcc was in /usr/bin, but not gcc-4.2. So I just did the following:
$ cd /usr/bin
$ sudo ln -s gcc gcc-4.2
which creates a link, gcc-4.2, which the gem is looking for that goes back to gcc.
Hope that helps.
It requires to install ruby-dev before installing bcrypt-ruby.
If you are using Ubuntu, run
sudo apt-get install ruby1.9.1-dev
or
sudo apt-get install ruby1.8-dev
based on RUby version.
I'm using RVM & I kept having this issue whenever installing gems with native extensions (bcrypt-ruby, bson-ext, json, eventmachine, nokogiri, linecache19, etc.)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
Only way I could finally get things working was to uninstall then re-install ruby.
rvm remove 1.9.2
rvm install 1.9.2
Thanks to tip from #doublebee here:
https://github.com/flori/json/issues/78#issuecomment-1499920
You only need use rvm (ruby version manager)
rvm uninstall 1.9.3
and then
rvm install 1.9.3
looks this error is on build of rvm 1.9.3, but uninstall and reinstalling fix the problem with bcrypt-ruby 3.0.1
sudo apt-get install ruby1.9.1-dev
whoked charm for me! Thanks a lot
Well, it works with Ruby 1.9.2 under RVM on MacOS 10.6.7:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
$ gem install bcrypt-ruby
Fetching: bcrypt-ruby-2.1.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-ruby-2.1.4
1 gem installed
Installing ri documentation for bcrypt-ruby-2.1.4...
Installing RDoc documentation for bcrypt-ruby-2.1.4...
Try rvm notes and see if it says you need to install anything.
If you are using version 1.8 the required packages for bcrypt are in the dev bundle. Try using
$sudo apt-get install ruby1.8-dev
then
$gem install bcrypt-ruby
This fix work for me on ubuntu on osx use homebrew, macports whatever:
sudo apt-get install ruby1.9.1-dev
I think you need to reinstall bundler gem.
gem install bundler
and then
bundle install

ImageMagick / RMagick - Can't install RMagick 2.13.1. Can't find Magick-config

I used a script to install ImageMagick http://github.com/masterkain/ImageMagick-sl
After a while, I got ImageMagick installed.
Then I ran sudo gem install rmagick and got
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
.rvm/rubies/ruby-1.9.2-p0/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...
I'm working in OSX Snow Leopard with Ruby 1.9.2 and Rails 3. Any ideas?
I was getting the same error and it got resolved after installing the libmagick9-dev library on ubuntu 11.
Update (Thanks to the commenters - Dec. 2012)
$ sudo apt-get install libmagickwand-dev or $ sudo apt-get install graphicsmagick-libmagick-dev-compat for ubuntu 12
$ sudo apt-get install libmagickwand-dev or $ sudo apt-get install libmagick9-dev for ubuntu 11 or below.
$ yum install ImageMagick-devel for centos
$ brew install imagemagick for Mac OS (using Homebrew)
you need the imagemagick libraries under ubuntu
$ sudo apt-get install libmagickwand-dev
it contains all missing libraires
then run bundle install command
I believe you need the Imagemagick libraries.
If you are using Homebrew (which I'd highly recommend), simply do
$ brew install imagemagick
Then rerun bundle install
Mac OS Mountain Loin (using Homebrew)
download and install http://xquartz.macosforge.org/trac/wiki/X112.7.2
brew install imagemagick
gem install rmagick
sudo apt-get install libmagickwand-dev
works well for Ubuntu 12.10
This is assuming you have installed all other dependencies viz.
sudo apt-get install imagemagick ruby ruby-dev gem`
On CentOS 5.7, I got it to work by first specifying PKG_CONFIG_PATH:
export PKG_CONFIG_PATH=/usr/local/src/ImageMagick-6.7.5-10/magick/
gem install rmagick
For those who got
InitializeMagick() in -lMagickCore... no; -lMagick... no; -lMagick++... no;
this worked for me in OS X 10.8: https://github.com/maddox/magick-installer
From here: RVM + Ruby 1.9.2 + Rmagick + Lion = System Works, RVM Doesn't
Initially, I came around to installing rmagick because it seemed to be a dependency when I tried installing libgtk2.0-dev. I was trying to install that package, because the RGtk2.0 is a requirement for using R package called rattle.
Anyway, none of the above solutions worked for me in installing in my Ubuntu 12.04. Even running sudo apt-get update first didn't seem to help, nor this related posting: Installing rmagick on Ubuntu
I eventually found what works is to troubleshoot using sudo aptitude rather than apt-get.
https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages
I recommend the technique of using aptitude to work through the package installation issue.
On Mac Os X, check if /opt/local/bin is in your PATH. If not:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
sudo gem install rmagick
This worked for me!
I had an issue installing Rmagick gem version 2.13.2 on Debian Jessie. After fighting with the packages in the other answers, I upgraded the version of the Rmagick gem from 2.13.2 to the latest (2.16.0 at time of writing). This installed successfully.
bundle update rmagick
If you tried all solutions, of all posts of whole Internet, have installed and reinstalled many times all indicated packages in all Linux or Mac distributions/versions (even in Windows) and it still not working, close your terminal and open it again. Some times, even if your reload all shell environment, only after I reopen the terminal the bundle install was successfully completed.
After several days of searching, my problema was related to some missing libraries, and the one that get the gem installed was this one:
brew install pkg-config
after this I did my bundle install again and it worked.

Resources