无法在OS X Mavericks上将Ruby降级 [英] Trouble downgrading Ruby on OS X Mavericks

查看:76
本文介绍了无法在OS X Mavericks上将Ruby降级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OS X 10.9随附ruby 2.0.0p195,但我需要安装Ruby 1.8.7.我一直遇到错误.我已经安装了Xcode5-DP,并且我相信也安装了命令行工具.

OS X 10.9 comes with ruby 2.0.0p195 but I need to install Ruby 1.8.7. I keep running into errors. I have Xcode5-DP install and I believe Command Line Tools is installed too.

在终端机中:

sudo rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10/x86_64/ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Installing Ruby from source to: /Users/alextoul/.rvm/rubies/ruby-1.8.7-p371, this may take a while depending on your cpu(s)...
ruby-1.8.7-p371 - #downloading ruby-1.8.7-p371, this may take a while depending on your connection...
ruby-1.8.7-p371 - #extracted to /Users/alextoul/.rvm/src/ruby-1.8.7-p371 (already extracted)
Patch stdout-rouge-fix was already applied.
Patch no_sslv2 was already applied.
ruby-1.8.7-p371 - #configuring...
Error running 'env CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl098/lib ./configure --prefix=/Users/alextoul/.rvm/rubies/ruby-1.8.7-p371 --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /Users/alextoul/.rvm/log/ruby-1.8.7-p371/1371228839_configure.log
There has been an error while running configure. Halting the installation.

1371228839_configure.log说:

1371228839_configure.log says:

./configure
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i686-apple-darwin13.0.0
checking host system type... i686-apple-darwin13.0.0
checking target system type... i686-apple-darwin13.0.0
checking whether the C compiler works... no
configure: error: in `/Users/alextoul/.rvm/src/ruby-1.8.7-p371':
configure: error: C compiler cannot create executables
See `config.log' for more details

其他(有用)信息:

ruby -v
> ruby 2.0.0p195 (2013-05-14 revision 40734) [universal.x86_64-darwin13]
brew update
> Already up-to-date.
gcc --version
> Configured with: --prefix=/Applications/Xcode5-DP.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode5-DP.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
> Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn)
> Target: x86_64-apple-darwin13.0.0
> Thread model: posix
sudo rvm requirements
> Installing requirements for osx, might require sudo password.
> Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.

感谢您的帮助.

推荐答案

10.9是该操作系统的早期Beta版本. [请注意此答案的2013年7月日期]如果我运行的是10.9,我认为我将不得不从头开始重新安装操作系统至少两次. (至少在beta周期中一次,因为它是beta,而在10.9正式发行时,有一次,因为beta).

10.9 is an early beta build of the OS. [ please note the July 2013 date of this answer] If I were running 10.9 I would assume I'll have to reinstall the operating system from scratch at least 2 more times. (At least once during the beta cycle because, well, it's beta, and once when 10.9 comes out in general release, because, well, beta).

鉴于此,我建议采取四个行动方案(选择1个或多个):

Given this I suggest four courses of action (pick 1 or many):

  • 与RVM团队合作,深入研究10.9可能已更改的编译器环境,并进行Ruby 1.8.7编译.这比较棘手,因为从技术上讲,这些东西属于NDA.
  • 相反,请设置一个VM并在该VM上运行Ruby 1.8.7.使用 Vagrant 和Chef/Puppet的奖励积分,因为您甚至可能需要重建VM. (只需将Vagrantfile和Puppet或Chef配置文件保存在Github/Dropbox/任何文件上,以便您可以克隆它们并从头开始重新生成VM.)
  • 或者只需重新启动到10.8即可完成生产工作. 10.8是生产级别的OS,应谨慎对待10.9,因为它可能会吞噬您的工作.实际上,不应将其用于生产目的(又名:每天编写Ruby代码).如果您要在Cocoa/Objective-C中编写仅10.9的应用程序(或更新RubyMotion或其他内容),那可能又是另一回事了(但我仍然会保留良好的备份并轻柔地对待它).
  • 努力更新Ruby 2.0的代码库,因为无论如何都不再正式支持Ruby 1.8.7.
  • Work with the RVM guys and dig into 10.9's probably-changed compiler environment and get Ruby 1.8.7 compiling. This is trickier because technically this stuff is under NDA.
  • Instead, set up a VM and run Ruby 1.8.7 on the VM. Bonus points for using Vagrant and Chef/Puppet, because you may even need to rebuild the VM. (Just keep the Vagrantfile and Puppet or Chef config files on Github/Dropbox/whatever so you can clone them and regenerate your VM from scratch.)
  • OR simply reboot to 10.8 to get production work done. 10.8 is a production level OS, 10.9 should be treated with caution - it could eat your work. It really shouldn't be used for production purposes (aka: day to day writing Ruby code). If you're writing a 10.9 only app in Cocoa/Objective-C (or updating RubyMotion or something) that might be another thing (but I'd still keep good backups and treat it gently).
  • Work towards updating your code base for Ruby 2.0, as Ruby 1.8.7 is no longer officially supported anyway.

编辑(2013年10月24日)::如果因为安装了Mavericks(2013年10月22日发布)而在这里,则希望在此版本发布后的几天内使Ruby 1.8.7正常工作,并且RVM不适用于您(因为您不耐烦且无法等待),这是您可以做的(应该可以使用,尽管我不是rbenv用户):

Edit (Oct 24, 2013): If you're here because you just installed Mavericks (released Oct 22, 2013), want to get Ruby 1.8.7 working a few days after this release, and RVM isn't working for you (because you're impatient and can't wait), here's what you can do (which should work, although I'm not an rbenv user):

  1. 使用macports安装port install ruby.这是Ruby 1.8.7.该编译在我的Mavericks机器上为我工作(尽管您需要在撰写本文时从源代码安装Macports,并且即使安装了XCode 5,也要安装命令行开发人员工具.是的,确实如此).
  2. 现在,安装 rbenv .
  3. ~/.rbenv/versions/文件夹中的
  4. 符号链接/opt/local/bin/ruby1.8.特别是~/.rbenv/versions/ruby-1.8.7-p374
  5. 阅读rbenv文档,但现在应该可以使用! (至少来自文档.同样,不是rbenv用户,但可以在电视上播放)
  1. Use macports to install port install ruby. This is Ruby 1.8.7. This compilation worked for me on my Mavericks machine (although you will need to install Macports from source at this writing and install the command line developer tools, even if you have XCode 5 installed. Yes, really).
  2. Now, install rbenv.
  3. Symlink /opt/local/bin/ruby1.8 in the ~/.rbenv/versions/ folder. Specifically ~/.rbenv/versions/ruby-1.8.7-p374
  4. Read the rbenv documentation, but it should work now! (At least from the documentation. Again, not an rbenv user, but do play one on TV)

我确定您也可以使用自制软件来做到这一点,但是我知道Ruby 1.8.7可以在最新的Macports上正确安装,因为这就是我使用的方式(它对我来说是干净安装的).

I'm sure you can do this with homebrew too, but I know Ruby 1.8.7 installs correctly with the latest Macports, because that's what I use (and it just installed cleanly for me).

这篇关于无法在OS X Mavericks上将Ruby降级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆