json - 当我尝试 sudo gem install json 我收到以下错误

我需要安装 JSON gem 来启动我的应用程序,但每当我尝试安装 json gem 时都会收到以下错误。谁能帮我吗。我正在使用 rails 2.2.2 和 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

最佳答案

使用 Mavericks,您可以通过从命令行安装 Xcode 命令行工具来解决此问题,如下所示:

xcode-select --install

更新: 安装或更新后不要忘记接受许可协议(protocol):

sudo xcodebuild -license

https://stackoverflow.com/questions/761521/

相关文章:

c# - 使 ASP.NET WCF 将字典转换为 JSON,省略 "Key"和 "Value"标记

ruby-on-rails - 将文件发送到 Rails JSON API

javascript - 未捕获的类型错误 : Cannot read property 'prop

javascript - AngularJS 资源获取失败

javascript - 如何在不解析的情况下在javascript中同步包含JSON数据?

json - 如何解析 JSON 文件?

json - Jackson:有没有办法将 POJO 直接序列化为 treemodel?

json - 将 JSON 与 LogStash 一起使用

c# - 反序列化期间的 JSON.Net Ignore Property

json - 浏览器 JSON 插件