What's the Difference Between Gem_Home and Gem_Path

What's the difference between GEM_HOME and GEM_PATH?

GEM_PATH provides the locations (there may be several) where gems can be found.

GEM_HOME is where gems will be installed (by default).

(Therefore GEM_PATH should include GEM_HOME).

$GEM_HOME and $GEM_PATH are wrongly set in Passenger

Reason for this issue was user_sandboxing by passenger

Since my app directory was owned by root, and I had no passenger_default_user configured in nginx, passenger was staring application as user nobody and group nogroup

I fixed this issue by changing owner of my app directory to a non-root user.

Note: Also I had to go with rvm instead of ruby:2.3.1 base image.

How to change gem installation directory on Mac?

You need to set your GEM_HOME and GEM_PATH

GEM_PATH specifies the locations where gems is to be found.

GEM_HOME specifies the location where the gems will be installed.

export GEM_HOME=<new location>

But if you do not want to change the Path and just want to install a few gems, you can also do the following:

gem install --install-dir /path_to_new_directory my-gem-name

example:

gem install --install-dir /Users/xyz/Desktop sass

will install rails on the Desktop

gem locations in macOS with chruby and TextMate preferences

Changed GEM_HOME and GEM_PATH to $HOME/.gem/ruby/2.6.2:$HOME/.rubies/ruby-2.6.2/lib/ruby/gems/2.6.0 based on copying the those variables from what showing up when running from the terminal. Lu's comment made me look a little harder at what was being reported. Basically I was missing $HOME/ in the second path (after the colon). I have been fiddling with this for months



Related Topics



Leave a reply



Submit