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
649 views
in Technique[技术] by (71.8m points)

ruby - When I try sudo gem install json I get the following error

I need to install the JSON gem to start my app but I get the error below whenever I try to install the json gem. Can anyone help me out. I'm using rails 2.2.2 and gems 1.3.1.

Arions-macbook-pro:.ssh arion$ sudo gem install json
Password:
Sorry, try again.
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install json
can't find header files for ruby.


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.1.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.1.4/ext/json/ext/parser/gem_make.out
See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

With Mavericks, you can solve this problem by installing the Xcode Command Line Tools from the command line like this:

xcode-select --install

Update: Don't forget to accept the license agreement after you install or update:

sudo xcodebuild -license


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

...