由于JSON v(1.7.3)gem错误,无法在Mac OS Mountain Lion上运行Bundle Install

时间:2013-03-19 16:31:55

标签: ruby-on-rails ruby json

首先,我已经在我的mac上安装了xcode的命令行工具,所以这不是问题。请不要指向我关于此的其他50篇帖子,因为他们只是说“安装命令行工具”。

这是我运行bundle install

时遇到的错误
Installing json (1.7.3) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
creating Makefile

make
compiling parser.c
make: gcc-4.2: No such file or directory
make: *** [parser.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/json-1.7.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.

我一直在寻找所有地方,有些人告诉我安装install ruby-dev命令,但我没有找到mac解决方案,因为我没有apt-get安装。

此外,查看错误,看起来文件试图去的地方缺少一个目录。我不知道该怎么做呢?

我一直无法找到重新安装ruby的方法。

任何简单的解决方案吗?

非常感谢!

编辑:这是我的本地宝石列表,我正在运行GCC版本4.2.1,以及Ruby版本1.9.3-p194

有什么奇怪的是已经安装了更新版本的JSON(1.7.5),所以我不知道它为什么要安装1.7.3,也许有一个有依赖的gem?我希望我可以跳过那个宝石,并安装捆绑的其余部分。应该满足1.7.5的依赖性,除非gem要求特定版本,对吧?

*** LOCAL GEMS ***

actionmailer (3.2.13, 3.2.7, 3.2.6)
actionpack (3.2.13, 3.2.7, 3.2.6)
activemodel (3.2.13, 3.2.7, 3.2.6)
activerecord (3.2.13, 3.2.7, 3.2.6)
activeresource (3.2.13, 3.2.7, 3.2.6)
activesupport (3.2.13, 3.2.7, 3.2.6)
appscrolls (0.9.0, 0.8.4)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bourne (1.4.0, 1.2.1)
builder (3.2.0, 3.0.0)
bundler (1.3.4, 1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.1, 1.3.3)
comp_tree (1.1.3)
devise (2.2.3, 2.1.2)
draper (1.1.0)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
hike (1.2.1)
i18n (0.6.4, 0.6.1, 0.6.0)
journey (1.0.4)
jquery-rails (2.2.1, 2.1.1, 2.0.2)
js-routes (0.8.7)
json (1.7.5)
mail (2.5.3, 2.4.4)
metaclass (0.0.1)
mime-types (1.21, 1.19)
mocha (0.13.3, 0.12.7)
multi_json (1.7.1, 1.3.6)
orm_adapter (0.4.0)
polyglot (0.3.3)
pure (0.2.2)
rack (1.5.2, 1.4.5, 1.4.1)
rack-cache (1.2)
rack-ssl (1.3.3, 1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.13, 3.2.7, 3.2.6)
railties (3.2.13, 3.2.7, 3.2.6)
rake (10.0.3, 0.9.2.2)
rdoc (4.0.0, 3.12)
request_store (1.0.5)
ruby_parser (3.1.2)
rubygems-bundler (1.1.1, 1.0.3)
rvm (1.11.3.6, 1.11.3.5)
sass (3.2.7, 3.2.1, 3.1.20)
sass-rails (3.2.6, 3.2.5)
sexp_processor (4.2.0)
shoulda (3.4.0)
shoulda-context (1.0.2)
shoulda-matchers (1.5.1, 1.5.0)
simple_form (2.1.0, 2.0.2)
sprockets (2.9.0, 2.2.2, 2.1.3)
sqlite3 (1.3.6)
state_machine (1.1.2)
thor (0.17.0, 0.16.0, 0.15.4)
tilt (1.3.6, 1.3.3)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.37, 0.3.33)
uglifier (1.3.0, 1.2.7)
warden (1.2.1)

1 个答案:

答案 0 :(得分:1)

听起来你没有安装GCC。至少有三种方法可以实现它:

  1. 转到App Store。安装Xcode。然后,在Xcode中,选择Xcode>偏好>下载并单击命令行工具旁边的安装。

  2. 登录Apple Developer站点,转到downloads page并下载命令行工具磁盘映像。安装。

  3. 通过自制软件,macports或从头开始编译来安装GCC。