Environment Variables
In addition to
using arguments and options on the command line, the Ruby interpreter
uses the following environment variables to control its behavior. The
ENV
object contains a list of current environment
variables.
DLN_LIBRARY_PATH
Search path for dynamically loaded modules.
HOME
Directory moved to when no argument is passed to
Dir::chdir
. Also used byFile::expand_path
to expand “~”.LOGDIR
Directory moved to when no arguments are passed to
Dir::chdir
and environment variableHOME
isn’t set.PATH
Search path for executing subprocesses and searching for Ruby programs with the
-S
option. Separate each path with a colon (semicolon in DOS and Windows).RUBYLIB
Search path for libraries. Separate each path with a colon (semicolon in DOS and Windows).
RUBYLIB_PREFIX
Used to modify the RUBYLIB search path by replacing prefix of library
path1
withpath2
using the formatpath1
;path2
orpath1path2
. For example, ifRUBYLIB
is:/usr/local/lib/ruby/site_ruby
and
RUBYLIB_PREFIX
is:/usr/local/lib/ruby;f:/ruby
Ruby searches
f:/ruby/site_ruby
. Works only with DOS, Windows, and OS/2 versions.RUBYOPT
Command-line options passed to Ruby interpreter. Ignored in taint mode (where
$SAFE
is greater than 0).RUBYPATH
With
-S
option, search path for Ruby programs. Takes precedence overPATH
. Ignored in taint mode (where$SAFE
is greater than 0).RUBYSHELL
Specifies shell for spawned processes. If not set,
SHELL
orCOMSPEC
are checked.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.