Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set GEM_HOME for system Ruby but not for other versions? #975

Closed
reitermarkus opened this issue Mar 1, 2017 · 3 comments
Closed

Comments

@reitermarkus
Copy link

On macOS, the default system Ruby needs sudo to install Gems, but now, when I set GEM_HOME, rbenv will install Gems for any version inside GEM_HOME, instead of keeping separate directories for each Ruby version.

How can I set a custom GEM_HOME for only the system Ruby?

@jeremy
Copy link
Member

jeremy commented Jun 13, 2017

If you're setting GEM_HOME so you can install gems without needing to sudo, I'd recommend using gem install --user-install instead.

@jeremy jeremy closed this as completed Jun 13, 2017
@Nakilon
Copy link

Nakilon commented Jun 14, 2017

@jeremy does rbenv install gems to different folders per ruby version with that --user-install flag?

@jeremy
Copy link
Member

jeremy commented Jun 14, 2017

RubyGems installs to Gem.user_dir when --user-install is passed. I did a web search for docs and took at look at the code on GitHub, and user_dir does include the Ruby version. Check out http://guides.rubygems.org/faqs/#user-install, for example.

Note that you have --install-path and --bin-path at your disposal, too. I'd recommend looking at RubyGems source code to dig much further, since these are poorly documented and undocumented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants