Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubygems do not install on OS X Lion

I used to have no problems at all with ruby, gems and all related stuff. But after installing X Code Developer Tools and upgrading to Lion the gems do not install.

I get the following error for every gem. This is the message for sqlite as an example:

Building native extensions.  This could take a while... ERROR:  Error installing sqlite3: 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/sqlite3-1.3.4 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out 

What went wrong? How to fix it?

like image 256
d135-1r43 Avatar asked Sep 17 '11 11:09

d135-1r43


People also ask

Where are RubyGems installed?

When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.

How install RubyGems manually in Kali Linux?

Step 1: In order to install RubyGems, first we need to install ruby on Linux. Run the following command on the terminal to install ruby. Step 2: Go to the RubyGems download page and click on the zip button, this will download the zip through which you can install RubyGems.

Is RubyGems included with Ruby?

Ruby comes with RubyGems by default since version 1.9, previous Ruby versions require RubyGems to be installed by hand. Some other libraries are released as archived (.


2 Answers

I had to install the Command Line Tools in the latest Xcode-Version (4.3.1) and

sudo gem install rails 

worked like a charm.

To install Command Line Tools, go to Xcode Preferences > Downloads or use the following command in terminal (thx @Purell):

xcode-select --install 
like image 197
shadowhorst Avatar answered Sep 23 '22 06:09

shadowhorst


I'm using Mavericks and Ruby 2.0.0 and I also got this error (mkmf.rb can't find header files) when installing gems. I solved this issue by creating some symbolic links in Terminal.

#First install developer tools again: xcode-select --install  #Create symbolic link to Ruby include (updated for 10.9) sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include  #Create symbolic link to config.h (updated for 10.9) sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0/Headers/ruby/config.h /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/config.h 
like image 20
David Douglas Avatar answered Sep 22 '22 06:09

David Douglas