Reputation: 2305
// Start background info.
I just want to install ruby on rails for development (OSX El Capitan).
Pain point:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Solution: Installed rbenv to manage / modify a separate ruby.
rbenv is currently using my system ruby - so I've downloaded an identical version through rbenv install.
// end background info.
Actual Question: Do I set rbenv local, global or shell ruby version to the newly downloaded version?
Upvotes: 3
Views: 2638
Reputation: 86
According to the official rbenv documentation in Github, their differences are the following:
# Sets a local application-specific Ruby version
# by writing the version name to a `.ruby-version`.
$ rbenv local <version>
# Sets the global version of Ruby to be used in all shells
# by writing the version name to the `~/.rbenv/version` file
$ rbenv global <version>
# Sets a shell-specific Ruby version by setting the
# RBENV_VERSION environment variable in your shell.
# This for temporary use and will only work during the terminal session
$ rbenv shell <version>
Note that your terminal session will no longer respect any .ruby-version files. You need to run rbenv shell --unset to enable the auto switch again.
Happy Coding :)
Upvotes: 1
Reputation: 211560
Usually rbenv
does the dirty work for you if loaded correctly, but if you need to change the global setting, you can always update it:
rbenv global 2.3.0
Then you can check that's properly applied with:
rbenv versions
The *
indicates the currently active ruby
. Test with:
ruby -v
That should be the version you're asking for.
Using rbenv
is a lot better than the system ruby, so I hope it works out for you.
Upvotes: 2