【发布时间】:2015-08-28 06:39:10
【问题描述】:
我在使用 mac 并试图弄清楚如何将我的 ruby 从 2.1.1 升级到 2.1.7。
我不断收到我无法弄清楚的错误。
当我试图确定我的 Mac 上是否有 Homebrew 时,我尝试:
which brew
这给了:
/usr/local/bin/brew
然后我尝试: MJ-2:~ m$ brew doctor
我得到:
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0
MJ-2:~ m$
我尝试使用 rvm 升级为:
rvm install ruby 2.1.7
我得到:
Warning! PATH is not properly set up, '/Users/m/.rvm/gems/ruby-2.0.0-p247/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p247'.
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.1.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
然后我尝试:
rvm get stable --auto-dotfiles
我得到一长串错误,主要是:
scripts/functions/support: Can't unlink already-existing object
最后是:
tar: Error exit delayed from previous errors.
Could not extract RVM sources.
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
我不明白出了什么问题。似乎 HomeBrew 不再在我的 Mac 上,或者至少在我的 Mac 上无法识别(尽管哪个 brew 有文件路径),而且我似乎也无法使用 rvm install 命令。
如何在 Mac 上从终端升级我的 ruby 版本?
【问题讨论】:
-
我认为您需要先升级 Homebrew,因为它正在寻找系统 Ruby 1.8,而较新的 OSX 已升级捆绑的 Ruby,这意味着如果您的 OSX 启动,Homebrew 的
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby不应该存在-迄今为止。 -
我试过 brew update 但我得到这个错误:
-
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: 坏解释器:没有这样的文件或目录 /usr/local/bin/brew:第 23 行:/usr/local/Library/brew.rb:未定义的错误:0
-
嗯,是的。您不能使用 Homebrew,这就是问题所在。我会 uninstall it 和 start fresh。
-
有没有办法不用自制?