3

Mac OS X10.7.3Lionでruby-debugをロードできません。

パスが正しくない理由がわかりません。

Rubyのバージョンは1.8.7で、Lionに標準で付属しています。

インストールされた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

3 に答える 3

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
于 2012-02-29T03:57:28.387 に答える
0

ライオンにレールを取り付けようとしたときに、同じ問題に直面しました。これが私がそれを解決する方法です。

rvmをインストールします

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

osx-gcc-installerをインストールします

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

新しいバージョンのrubyをインストールしました

rvm install 1.9.3

要件を表示するには、次のコマンドを入力します

rvm requirements

システムrubyの代わりに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は今レールのために読まれています!! わーい!!

于 2012-04-08T15:39:28.877 に答える
0

おそらく、ここにある RVM を介して Ruby をインストールすることになります (実際にはそうすべきです) 。それが完了したら、次のように Ruby をインストールする必要があります。

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

重要な部分は--with-gcc-clang、clang を使用するようにシステムに指示する です。そこから、インストール コマンドで指定したバージョンの Ruby 用に gem をインストールする必要があります。

于 2012-02-27T22:10:24.607 に答える