从2.0.0更新ruby

时间:2016-08-23 00:14:50

标签: ruby-on-rails ruby macos

如何将ruby从2.0.0更新到最新的ruby for my book air?我已经尝试了大多数CLI教程并且有一些错误,这些错误也不允许我下载rails。这是我在尝试使用rbenv更新时遇到的错误:

 $ rbenv install 2.3.1 
Downloading ruby-2.1.3.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.3.tar.bz2 Installing ruby-2.1.3...  
WARNING: ruby-2.1.3 is nearing its end of life. It only receives critical security updates, no bug fixes.
BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)
Inspect or clean up the working tree at /var/folders/6h/xq5sgstd3ynfkc4qcp53m0dh0000gn/T/ruby-build.20160822200825.84956
Results logged to /var/folders/6h/xq5sgstd3ynfkc4qcp53m0dh0000gn/T/ruby-build.20160822200825.84956.log
Last 10 log lines: 
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [main.o] Error 2
make: *** Waiting for unfinished jobs....
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''    
/bin/sh: -c: line 1: syntax error: unexpected end of file Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 
make: *** [dmydln.o] Error 2

2 个答案:

答案 0 :(得分:2)

你的意思是红宝石2.3.1? 2.1.3有警告。

我也建议使用自制软件。

brew install rbenv ruby-build

# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

# Install Ruby
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
gem install bundler

更多信息:https://gorails.com/setup/osx/10.11-el-capitan

答案 1 :(得分:0)

在我的情况下,安装崩溃了,因为我最近重新安装了Xcode而忘记安装命令工具。

运行后

sudo xcode-select --install

我使用rbenv成功安装了Ruby。