2012-04-20 32 views
4

我將我的Mac OSX版本更改爲Lion。但是我不能創建一個Rails3應用程序。Rails無法在Lion上工作

我使用rvm 1.9.2,我選擇了ruby 1.9.2-p290來創建Rails 3應用程序。

一切似乎okey。當我開始創建一個新的應用程序

rails new new_my_app 

我看到這個錯誤,

Installing json (1.6.6) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /Users/ender/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
creating Makefile 

make 
sh: make: command not found 


Gem files will remain installed in /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6 for inspection. 
Results logged to /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6/ext/json/ext/generator/gem_make.out 
An error occured while installing json (1.6.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.6.6'` succeeds before bundling. 

當我嘗試

gem install json -v '1.6.6' 

我面對這個錯誤

Building native extensions. This could take a while... 
ERROR: Error installing json: 
    ERROR: Failed to build gem native extension. 

     /Users/ender/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
creating Makefile 

make 
sh: make: command not found 


Gem files will remain installed in /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6 for inspection. 
Results logged to /Users/ender/.rvm/gems/ruby-1.9.2-p290/gems/json-1.6.6/ext/json/ext/generator/gem_make.out 

什麼都要我確實解決了這個問題?

謝謝。

回答

1

你需要安裝OSX-GCC-安裝

如果你遷移從previoys系統,您需要重新安裝紅寶石和寶石紅寶石:

rvm reinstall 1.9.2 
rvm use 1.9.2 
rvm gemset pristine 
1

我有這個問題,這個固定爲我。我最近從舊系統遷移到新的iMac。

我首先安裝了libksba。我不確定是否有必要,但我想它不會受到傷害。我用homebrew所以這是我做過什麼:

brew install libksba 

然後,我更新RVM。

rvm get head 

更新後,它告訴我,我需要安裝Ruby-1.9.3-P194。

rvm install ruby-1.9.3-p194 

安裝了1.9.3。我想爲一些較舊的應用程序1.9.2,所以我然後重新安裝。

rvm reinstall 1.9.2 

最後,我安裝了JSON的寶石,是造成此問題:

gem install json -v '1.6.6' 

中提琴!它正確安裝。我做的最後一件事是運行包,但它抱怨找不到這樣的:

Could not find multi_json-1.3.1 in any of the sources 

我刪除Gemfile.lock的,並重新運行包。

rm Gemfile.lock 
bundle 

和一切正常吧!

0

最後我贏了。也許這可能是簡單或簡單的方法。你懂。 首先,我更新了RVM,但在此之前,我從Lion的appstore安裝了Xcode 4。第二步是重新安裝最新的穩定紅寶石版本並創建我的寶石。 最後我下載導軌3。2到我之前設置的寶石套裝上,最後是紅寶石。

10

您需要在Xcode 4 for Lion的首選項中安裝「命令行工具」。

+2

這,這 - > http://stackoverflow.com/questions/9027772/failed-to-build-json-1-6-3-with-native-extension-after-i-installed-xcode-4 -2 終於使我的包再次工作! – Philip 2012-10-03 15:01:10

+1

這個鏈接對我來說是一個新鮮的osx山獅安裝,給了我這個錯誤。 – Catfish 2012-12-26 04:05:33

+0

與@Catfish相同。思想的命令行工具過來了,我的Time Machine在一個新的SSD上恢復了操作系統。它沒。解決了,謝謝! – 2013-03-11 22:23:31

相關問題