Created
November 8, 2010 18:28
-
-
Save thinkerbot/668037 to your computer and use it in GitHub Desktop.
Illustrates GEM_HOME vs GEM_PATH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Two ENV variables control the 'gem' command: | |
# | |
# GEM_HOME: the single path to a gem dir where gems are installed | |
# GEM_PATH: a standard PATH to gem dirs where gems are found | |
# | |
# A gem directory is a directory that holds gems. The 'gem' command will lay | |
# out and utilize the following structure: | |
# | |
# bin # installed bin scripts | |
# cache # .gem files ex: cache/gem_name.gem | |
# doc # rdoc/ri ex: doc/gem_name/rdoc | |
# gems # gem file ex: gems/gem_name/lib/gem_name.rb | |
# specifications # gemspecs ex: specifications/gem_name.gemspec | |
# | |
# As an example of usage: | |
export GEM_HOME=a | |
export GEM_PATH=a | |
gem install rack | |
gem list # shows rack | |
export GEM_HOME=b | |
export GEM_PATH=b | |
gem install rake | |
gem list # shows rake (not rack) | |
export GEM_PATH=a:b | |
gem list # shows rake and rack | |
# And if you set GEM_HOME=a:b, you will install into the 'a:b' directory :) |
Very clear.
It seems that GEM_HOME works as GEM_PATH too for searching gems.
Experiment:
export GEM_HOME = a
export GEM_PATH = b
gem list #shows rack and rake.
Observation:
It still lists both the gems.
Conclusion:
Seems like it GEM_PATH always has GEM_HOME in it. Wonder what are the default/initial values of GEM_PATH?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great.