4. Environment Variables
4.1 GEM Environment Variables
You can control the behavior of RubyGems through the following environment variables.
GEMCACHE
- Name of user defined cache file to use when the site wide cache file is unwritable. (NOTE: we will probably rename this to GEM_CACHE in the next revision to be consistent with the other environment variables).
GEM_HOME
- Directory containing the master gem repository.
GEM_PATH
- Path list of directories containing gem repositories to be searched in addition to the GEM_HOME directory. The list should be delimited by the appropriate path separator (e.g. ‘:’ on Unix and ‘;’ on Windows)
GEM_SKIP
- List of gems should should not be loaded (normally used for development). The list should be delimited by the appropriate path separator (e.g. ‘:’ on Unix and ‘;’ on Windows)
HOME
- Home directory of the user (see below).
HOMEDRIVE
- Drive containing the users home directory.
HOMEPATH
- Path to the user’s home directory.
http_proxy or HTTP_PROXY
- URL of the HTTP protocol proxy to be used to get out of the firewall. The lower case verion will be used first.
make
- Name of the make program that should be used to build extensions.
USERPROFILE
- Home directory of the user (used if HOME is not defined).
4.2 Finding a Home Directory
Finding the user’s home directory can be tricky across different systems. Gems tries the following in order until it finds one that works:
- Use HOME if it is defined.
- Use USERPROFILE if it is defined.
- Use HOMEDRIVE and HOMEPATH together if they are defined.
- Use the path you get by having Ruby expand “~”.
- Use “C:/” if you are on a Windows machine.