Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Illustrates GEM_HOME vs GEM_PATH
# 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 :)
@nicolasgarnil

This comment has been minimized.

Copy link

commented Nov 16, 2013

Great.

@codeitagile

This comment has been minimized.

Copy link

commented Aug 8, 2014

Very clear.

@parhs

This comment has been minimized.

Copy link

commented Oct 29, 2016

It seems that GEM_HOME works as GEM_PATH too for searching gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.