2012-02-27 72 views
3

無法在Mac OS X 10.7.3 Lion上加載ruby-debug。無法在Mac OS X 10.7.3 Lion中加載ruby 1.8.7中的ruby-debug

不確定路徑不正確的原因。

Ruby版本是1.8.7標準與獅子標準。

安裝的Xcode

Developer Information: 

    Version: No version information available 
    Location: /Applications/Xcode.app 
    Applications: 
    Xcode: 4.3 (1175) 
    Instruments: 4.3 (4321) 
    SDKs: 
    Mac OS X: 
    10.6: (10K549) 
    10.7: (11D50a) 
    iPhone OS: 
    5.0: (9A334) 
    iPhone Simulator: 
    5.0: (9A334) 


$ sudo gem install ruby-debug -v 0.10.4 
Password: 
Building native extensions. This could take a while... 
ERROR: Error installing ruby-debug: 
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/linecache-0.46 for  inspection. 
Results logged to /Library/Ruby/Gems/1.8/gems/linecache-0.46/ext/gem_make.out 


$ 

尋找Lion系統上ruby.h路徑,該路徑的不同。

./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/ruby.h 
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/ruby.h 
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/ruby.h 
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0/ruby.h 

從這一點來看,最好的方法是什麼?

感謝,

PB

回答

4

解決方案:需要安裝Xcode 4.3,然後從Xcode首選項 - 常規中安裝Xcode命令行工具。

如果沒有命令行工具,則會生成上述錯誤。

一旦安裝,Ruby-Debug加載。

$ sudo gem install ruby-debug -v 0.10.4 
Password: 
Building native extensions. This could take a while... 
Building native extensions. This could take a while... 
Successfully installed linecache-0.46 
Successfully installed ruby-debug-base-0.10.4 
Successfully installed ruby-debug-0.10.4 
3 gems installed 
Installing ri documentation for linecache-0.46... 
Installing ri documentation for ruby-debug-base-0.10.4... 
Installing ri documentation for ruby-debug-0.10.4... 
Installing RDoc documentation for linecache-0.46... 
Installing RDoc documentation for ruby-debug-base-0.10.4... 
Installing RDoc documentation for ruby-debug-0.10.4... 
$ rdebug -v 
ruby-debug 0.10.4 
0

在所有的可能性,你會(在所有的現狀,應該)通過RVM安裝Ruby,位於here。一旦你完成havee,你需要安裝你的紅寶石,像這樣

rvm install ruby-1.9.2-p290 --with-gcc=clang 

最重要的部分是--with-gcc-clang,它告訴系統使用鏗鏘。從那裏你的寶石應該安裝你在安裝命令中指定的Ruby版本。

+0

爲什麼Lion自帶的基礎ruby和gem無法安裝ruby-debug?我有紅寶石1.8.7基地249工作正常與紅寶石調試(0.10.3)在OS X 10.6.8。我明白你的建議,只是困惑爲什麼我不能用調試重建我的生產環境? – phil 2012-02-28 10:11:28

+0

你是否經常使用sudo安裝gem? – igreulich 2012-02-28 17:16:22

+0

在生產中是的,但在開發中,我把寶石放在〜home/usr。你有什麼建議? – phil 2012-02-28 21:37:45

0

我在試圖在Lion上安裝rails時遇到同樣的問題。這就是我可以解決的問題。

安裝RVM

$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

安裝OSX-GCC-安裝

https://github.com/kennethreitz/osx-gcc-installer

紅寶石安裝了新版本

rvm install 1.9.3

鍵入的以下命令來顯示要求

rvm requirements

要使用RVM Ruby安裝爲默認值,而不是系統的紅寶石:

rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems # migrate your gems rvm alias create default 1.9.3

安裝導軌:

sudo gem install rails

我的Mac現在被閱讀爲導軌!好極了!!