Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Mac OS X 10.7.3上加载ruby 1.8.7中的ruby调试_Ruby_Ruby Debug - Fatal编程技术网

无法在Mac OS X 10.7.3上加载ruby 1.8.7中的ruby调试

无法在Mac OS X 10.7.3上加载ruby 1.8.7中的ruby调试,ruby,ruby-debug,Ruby,Ruby Debug,无法在Mac OS X 10.7.3上加载ruby调试 不确定为什么路径不正确 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) SDK

无法在Mac OS X 10.7.3上加载ruby调试

不确定为什么路径不正确

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

很可能,您将(而且实际上应该)通过位于的RVM安装Ruby。一旦你这样做了,你需要像这样安装你的红宝石

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

重要的部分是
——带有gcc-clang
,它告诉系统使用clang。从这里开始,您的gems应该按照您在install命令中指定的Ruby版本进行安装。

解决方案:需要安装Xcode 4.3,然后从Xcode首选项常规安装Xcode命令行工具

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

一旦安装,Ruby调试将加载

$ 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
我在尝试在Lion上安装rails时遇到了同样的问题。这就是我可以解决它的方法

安装rvm

$curlhttps://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer |bash-s稳定

安装osx gcc安装程序

已安装ruby的新版本

rvm安装1.9.3

键入以下命令以显示需求

rvm要求

要使用RVM安装的Ruby作为默认值,而不是系统Ruby,请执行以下操作:

rvm系统;rvm gemset导出系统.gems;rvm 1.9.3;rvm gemset import system.gems#迁移您的gems
rvm alias创建默认1.9.3

已安装轨道:

sudogem安装rails


我的Mac现在可以阅读rails了!!耶

为什么Lion附带的基础ruby和gem无法安装ruby调试?我有ruby 1.8.7 base 249,可以在os x 10.6.8下与ruby debug(0.10.3)配合使用。我理解你的建议,只是不明白为什么我不能用debug重建我的生产环境?你经常用sudo安装gem吗?在生产中是的,但在开发中不是,我把gem放在~home/usr中。您有什么建议?这是从我的主目录运行的命令,我在主目录中有一个./usr目录结构。出现相同的路径问题。$gem安装ruby调试-v 0.10.3-i./usr构建本机扩展。这可能需要一段时间。。。错误:安装ruby调试时出错:错误:无法生成gem本机扩展/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/Ruby extconf.rb mkmf.rb在/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/Ruby.h中找不到Ruby的头文件。Gem文件将保留在/Users/pblen/usr/gems/linecache-0.46中以供检查。结果记录到/Users/pblen/usr/gems/linecache-0.46/ext/gem_make.out$