zhiming jiang zhiming jiang - 1 year ago 132
Ruby Question

Cannot install ruby on MAC 10.11.5

I cannot install ruby new version. I stall the home-brew and ruby-build, both install successful. I type $ rbenv, it shows


install Install a Ruby version using ruby-build


then i stall version 2.3.1

$ rbenv install 2.3.1

it shows error

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 ~

I does't have path /usr/local/var/rbenv, I only have path /usr/local/rbenv

Additions (here is the tutorial i have watched

Answer Source

You can try install ruby via rbenv following as this tutorial:

I tried it and success.

install rbenv on osx


You should do these steps as below:

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

Then you used rbenv to install ruby. First, find the desired version:

rbenv install -l

And rbenv install 2.3.1

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download