Install Rmagick Gem in Ubuntu Painlessly
Install Rmagick gem in Ubuntu Painlessly

tl;dr for busy ones
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagickwand-dev
gem install rmagickLet me guess why you are here!
You are about to install imagemagick gem in freshly setup laptop, and you try simple gem install imagemagick and currently your screen looks like this:
$ gem install imagemagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/untoldstory/.rvm/rubies/ruby-2.1.1/bin/ruby -r ./siteconf20160226-5081-j6qfa7.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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=/home/untoldstory/.rvm/rubies/ruby-2.1.1/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/untoldstory/.rvm/gems/ruby-2.1.1/gems/rmagick-2.15.4 for inspection.
Results logged to /home/untoldstory/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/rmagick-2.15.4/gem_make.outwhat is the solution?
You need to install some dependencies before you can proceed with installation of this gem.
Install imagemagick library
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install imagemagickInstall some more dependencies
After installing imagemagick if you try installing imagemagick gem you will see error, that looks like this:
$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/untoldstory/.rvm/rubies/ruby-2.1.1/bin/ruby -r ./siteconf20160226-22127-tgz3iy.rb extconf.rb
checking for gcc... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.15.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 de
tails. 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=/home/untoldstory/.rvm/rubies/ruby-2.1.1/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/untoldstory/.rvm/gems/ruby-2.1.1/gems/rmagick-2.15.4 for inspection.
Results logged to /home/untoldstory/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/rmagick-2.15.4/gem_make.outTo solve this, you will need to install some more libraries.
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagickwand-devInstall rmagick gem
Finally you can try to install rmagick gem and you will be successful!
gem install rmagickDid this help? please feel free to comment.
Happy learning!
Keep reading

Fix mise GitHub Rate Limit with a Token
mise makes unauthenticated GitHub API calls by default. When you hit the rate limit installing tools, a personal access token (no scopes required) fixes it permanently.

How to solve Deployment Failure-`assets:precompile`
I was trying to deploy rails 6 app on ec2 server using capistrano when precompile failure lead to whole deploymentt failure. I had to uninstall cmdtest and install yarn

How to Sort an Array of Objects in JavaScript
How to Sort an Array of Objects in JavaScript

What did you take away?
Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.
Comments are powered by Disqus. By posting you agree to theirterms.