无法在MAC 10.11.5上安装ruby

时间:2016-07-04 03:29:07

标签: ruby-on-rails ruby macos

我无法安装ruby新版本。我停止了家酿和红宝石搭建,两者都安装成功。我键入$ rbenv,它显示

...

install使用ruby-build

安装Ruby版本

...

然后我停止版本2.3.1

$ rbenv install 2.3.1

显示错误

Zhimings-MacBook-Pro:~ zhimingjiang$ rbenv install 2.3.1
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
mkdir: /usr/local/var/rbenv/versions/2.3.1/lib: Permission denied

BUILD FAILED (OS X 10.11.5 using ruby-build 20160426)

Inspect or clean up the working tree at /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035
Results logged to /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035.log

Last 10 log lines:
/var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035 ~
/var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035/ruby-2.3.1 /var/folders/wf/tkkf34w562q8mqb59f43lnrh0000gn/T/ruby-build.20160703231044.15035 ~

我没有路径/usr/local/var/rbenv,我只有路径/usr/local/rbenv

添加(这是我看过的教程 https://www.youtube.com/watch?v=jx0NrIbQbzI

2 个答案:

答案 0 :(得分:0)

您可以尝试通过ruby安装rbenv,如本教程所示:

我尝试过并取得了成功。

install rbenv on osx

更新

您应该执行以下步骤:

brew install rbenv
brew install ruby-build
echo 'export RBENV_ROOT=/usr/local/var/rbenv' >> ~/.bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile

然后你用rbenv来安装ruby。首先,找到所需的版本:

rbenv install -l

rbenv install 2.3.1

答案 1 :(得分:0)

我找到了

https://www.ruby-lang.org/en/documentation/installation/

搜索关键词“从源头构建”

按照说明操作 下载 - >解压缩 - >终端cd到文件夹 - >明星打出这三行称赞。

如果安装其他需要红宝石的话。您可能仍需要输入$。/ configure --with-openssl-dir = / usr / local / ssl