Why am I having a problem installing rmagick - ruby-on-rails

On Ruby 1.8.7 and rails 2.3.5 I get:
gem install rmagick
ERROR: Error installing rmagick:
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/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Building native extensions. This could take a while...
Cynicalgrinch:levelous pawel$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
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/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Gem_make.out says this:
/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

on Ubuntu/Debian you would need to install:
sudo apt-get install libmagickwand-dev
on RedHat/Fedora/CentOS:
yum install ImageMagick-devel

To install rmagick with the gem system, you must have "imagemagick" on your system. The following error line says that rmagick failed to build because the native extension (imagemagick) does not exist on your system.
ERROR: Failed to build gem native extension.
On OSX, you can use brew (the best way in my opinion) to install imagemagick. Once brew is installed :
brew install imagemagick
gem install rmagick
On Mountain Lion (OSX), after:
brew install imagemagick
it may be necessary to force the re-creation of some symlinks manually before being able to install the rmagick gem.
> brew link -f jpeg
> brew link -f libpng
> brew link -f freetype
> brew link -f imagemagick

On fedora make sure you have ImageMagick-devel installed.

Related

" ERROR: Failed to build gem native extension " in 16.04

I was trying to install Sass. Went through this guide to install Ruby which Sass website told is a pre-requisite
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-and-set-up-a-local-programming-environment-on-ubuntu-16-04
Looks like it went well
$ ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Now I am stuck at this point. I am not sure how to proceed further. I am using Ubuntu 16.04
$ sudo gem install sass
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171122-3627-1olbmft.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out
What should I do now ? Please help.
sudo apt-get install ruby-dev
The above command fixed it for me.
Try installing libffi-dev
sudo apt-get install libffi-dev

I got this error while trying to install rails ERROR: Failed to build gem native extension. (Ubuntu 16.04)

My ruby version is ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]. And my gem version is 2.5.1
I want to install rails, but when I try sudo gem install rails
It gives me this error
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160905-4032-nlscry.rb extconf.rb
mkmf.rb cant find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
Please let me know how to solve it, thank you.
try to install this dependencies
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev build-essential patch
and then run gem install

Error installing gem twitter on Ubuntu 15.04

Am trying to install twitter gem on Ubuntu 15.04 and this error keeps popping up
gem install twitter
Building native extensions. This could take a while...
ERROR: Error installing twitter:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/http_parser.rb-0.6.0/gem_make.out
You are getting this error because there is no ruby development environment installed. Development environment is needed to compile ruby extensions,
You should install development first using command below:
$ sudo apt-get install ruby-dev
I had a similar issue and i solved it by installing ruby-dev:
sudo apt-get install ruby-dev

Ruby Compass ERROR: Failed to build gem native extension

Hi I am running Ubuntu 15.04 and I am trying to install the Compass gem. I did a gem update like the Compass website told me to do. Then I tried to install Compass and got the following error.
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20150609-16406-5iavn8.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/ffi-1.9.8 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/ffi-1.9.8/gem_make.out
This is the output from the gem_make.out file
/usr/bin/ruby2.1 -r ./siteconf20150609-16446-49gin0.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Not sure what to do at this point. Thanks!
mkmf.rb can't find header files for ruby at
You need the ruby dev headers files to compile gems.
You need the package ruby2.1-dev.
You may also need other packages like build-essential.
Try the following:
sudo apt-get install ruby2.1-dev build-essential
On earlier versions of Ubuntu such as 14.04, you will need the ruby2.0-dev package instead.
sudo apt-get install ruby2.0-dev build-essential

Installation of Rails

I tried to install Rails on OS X Lion using the following command in Terminal:
sudo gem install rails
But I am getting the following error:
Building native extensions. This could take a while...
ERROR: Error installing rails:
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/json-1.7.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Any help would be appreciated.
First install the Command Line Tools in the latest Xcode-Version.
and then run sudo gem install rails
To install Command Line Tools, go to XCode Preferences > Downloads.

Resources