Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 views
in Technique[技术] by (71.8m points)

ruby on rails - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...