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

Fix sudo-less GEM_HOME detection #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix sudo-less GEM_HOME detection #188

wants to merge 1 commit into from

Conversation

nicolaevladescu
Copy link

When installing sudo-less the GEM_HOME var was no longer accurate, at least not for me on macOS Catalina. To avoid such errors automate the GEM_HOME discovery.

When installing sudo-less the GEM_HOME var was no longer accurate, at least not for me on macOS Catalina. To avoid such errors automate the GEM_HOME discovery.
@@ -51,8 +51,8 @@ tell RubyGems to install into your user directory by passing either the
The latter is in our opinion the best solution. To do this open up terminal and create or edit your `.bash_profile` with your preferred editor. Then enter these lines into the file:

```shell
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
export GEM_HOME="$(ruby -r rubygems -e 'puts Gem.user_dir')"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to suggest this because it would run ruby every time the profile is loaded.

$HOME/.gem looks correct to me except it doesn't have the ruby/[VERSION] suffix, but I don't personally know if that's required when setting GEM_HOME

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use the builtin ruby version on macOS, that is the only thing that works automagically. The only solution would be to type the version in by hand. I personally see no significant delay when my profile is loaded, and i am also running python and some other scripts in my profile amongst this one ruby call. I only load my profile after a reboot or if i quit the terminal or open a new window, things i do rarely. I think this approach will also benefit people who use rbenv to have multiple versions of ruby.

I wanted to give some reasoning and context, ultimately it's your decision, please close the PR if there is no further action needed.

Thank you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we probably want to switch, I just poked around on a clean machine and realistically this is the only way to pull it out.

An alternative, docs wise, is to offer the exact folders for OS versions, e.g. export GEM_HOME=.gem/ruby/2.6.0 for macOS 10.15+

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

Successfully merging this pull request may close these issues.

None yet

4 participants