3

无法在 Mac OS X 10.7.3 Lion 上加载 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

从这一点来看,最好的方法是什么?

谢谢,

4

3 回答 3

4

解决方案:需要安装 Xcode 4.3,然后从 Xcode Preferences-General 中安装 Xcode Command Line Tools。

如果没有命令行工具,则会生成上述错误。

一旦安装,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 安装 Ruby 。一旦你完成了,你将需要像这样安装你的红宝石

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

重要的部分是--with-gcc-clang,它告诉系统使用 clang。从那里你的 gems 应该为你在 install 命令中指定的 Ruby 版本安装。

于 2012-02-27T22:10:24.607 回答
0

尝试在我的 Lion 上安装导轨时遇到了同样的问题。这就是我可以解决的方法。

安装 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

要使用 RVM 安装的 Ruby 作为默认值,而不是系统 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 现在可以读取 Rails 了!!耶!!

于 2012-04-08T15:39:28.877 回答