Search code examples
ruby-on-railsrubyrbenv

rbenv ruby on rails global vs local vs shell


// 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?


Solution

  • 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.