Note: This document is for an older version of GRASS GIS that is outdated. You should upgrade, and read the current manual page.

_\|/_ GRASS logo

GRASS variables and environment variables

There are two types of variables: There are a number of shell environment variable groups: Any setting which needs to be modifiable by a GRASS program (e.g. MONITOR) has to be a GRASS gisenv variable.

GRASS-related Files

GRASS maintains some settings in a number of files on the system. They are detailed below.

Setting environment variables

Setting environment variables depends on the shell being used:

Bash:
export VARIABLE=value
Csh:
setenv VARIABLE value
Cmd.exe (Windows):
set VARIABLE=value

Setting environment variables permanently

Setting GRASS variables

Use g.gisenv within GRASS. This permanently predefines GRASS variables in the .grassrc6 file.

Usage:
g.gisenv set="VARIABLE=VALUE"
It looks unusual with two equals signs, but g.gisenv serves dual duty for getting and setting GRASS variables.

If the user just specifies a variable name, it defaults to get mode. For example:

g.gisenv GRASS_GUI
text

List of selected (GRASS related) environment variables

[ To be set from the terminal shell or startup scripts ]
GISBASE
directory where GRASS lives. This is set automatically by the startup script.
GISRC
name of .grassrc6 file. Defines the system wide value while in a GRASS session.
GRASS_ADDON_PATH
[grass startup script, g.extension]
specifies additional path(s) containing local and/or custom GRASS modules extra to the standard distribution.
GRASS_ADDON_ETC
[libgis, g.findetc]
specify paths where support files (etc/) may be found external to standard distribution.
GRASS_BATCH_JOB
defines the name (path) of a shell script to be processed as batch job.
GIS_ERROR_LOG
If set, $GIS_ERROR_LOG should be the absolute path to the log file (a relative path will be interpreted relative to the process' cwd, not the cwd at the point the user set the variable). If not set, $HOME/GIS_ERROR_LOG is used instead. The file will only be used if it already exists.
GRASS_ERROR_MAIL
set to any value to send user mail on an error or warning that happens while stderr is being redirected.
GRASS_GNUPLOT
[i.spectral]
program to use for plotting gnuplot data.
GRASS_GUI
either text or gui to define non-/graphical startup.
Can also specify the name of the GUI to use, e.g. tcltk (gis.m), oldtcltk (d.m) or wxpython (wxGUI). Also exists as a GRASS gisenv variable (see below). If this shell variable exists at GRASS startup, it will determine the GUI used. If it is not defined startup will default to the last GUI used.
GRASS_FONT_CAP
[g.mkfontcap, d.font, display drivers]
specifies an alternative location (to $GISBASE/etc/fontcap) for the font configuration file.
GRASS_HEIGHT
[d.mon]
defines the height of GRASS monitor, see also GRASS_WIDTH.
GRASS_HTML_BROWSER
[init.sh, d.m, gis.m]
defines name of HTML browser. For most platforms this should be an executable in your PATH, or the full path to an executable.

Mac OS X runs applications differently from the CLI. Therefore, GRASS_HTML_BROWSER should be the application's signature, which is a domain-like name, just reversed, i.e. com.apple.Safari. To find an application's signature, type the following in a Terminal (fill in the path to the application you are interested in, for example: /Applications/Safari.app):
    grep -A 1 "CFBundleIdentifier" /path/to/application.app/Contents/Info.plist
  The signature is the <string> following the <key>, without the bracketing <string> tags.
G_INFO_FORMAT_STANDARD
[init.sh, wxgui]
sets percentage output and message formatting style to standard formatting.
G_INFO_FORMAT_GUI
[init.sh, wxgui]
sets percentage output and message formatting style to GUI formatting.
G_INFO_FORMAT_SILENT
[init.sh, wxgui]
disables percentage output and error messages.
G_INFO_FORMAT_PLAIN
[init.sh, wxgui]
sets percentage output and message formatting style to ASCII output without rewinding control characters.
GRASS_INT_ZLIB
[libgis]
if the environment variable GRASS_INT_ZLIB exists, new compressed integer (CELL type) raster maps will be compressed using zlib instead of RLE compression. Such rasters will have a compressed value of 2 in the cellhd file.
Obviously, decompression is controlled by the raster's compressed value, not the environment variable.
GRASS_MESSAGE_FORMAT
[various modules, wxGUI]
it may be set to either
GRASS_MOUSE_BUTTON
[various modules]
swaps mouse buttons for two-button or left-handed mice. Its value has three digits 1, 2, and 3, which represent default left, middle, and right buttons respectively. Setting to 132 will swap middle and right buttons. Note that this variable should be set before a display driver is initialized (e.g., d.mon x0).
GRASS_PAGER
[various modules]
maybe set to either less, more, or cat.
GRASS_PERL
[used during install process for generating man pages]
set Perl with path.
GRASS_RND_SEED
set random seed for r.mapcalc rand() function.
GRASS_SKIP_MAPSET_OWNER_CHECK
By default it is not possible to work with MAPSETs that are not owned by current user. Setting this variable to any non-empty value allows the check to be skipped.
GRASS_SH
[shell scripts on Windows]
path to bourne shell interpreter used to run shell scripts.
GRASS_PYTHON
[wxGUI, Python scripting]
set to override Python executable.
On Mac OS X this should be the pythonw executable for the wxGUI to work.
GRASS_WXBUNDLED
[wxGUI]
set to tell wxGUI that a bundled wxPython will be used.
When set, the wxGUI will not check the wxPython version, as this function is incompatible with a bundled wxPython. It is up to the packager to make sure that a compatible wxPython version is bundled.
GRASS_TCLSH
[nviz]
set tclsh shell name to override 'tclsh'. It is probable that this is no longer used.
GRASS_XTERM
[lib/init/grass-xterm-wrapper, lib/init/grass-xterm-mac]
set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app startup defaults to an internal '$GISBASE/etc/grass-xterm-mac', which emulates the necessary xterm functionality in Terminal.app.
GRASS_UI_TERM
set to any value to use the terminal based parser.
GRASS_VERSION
reports the current version number (used by R-stats interface etc); should not be changed by user.
GRASS_WIDTH
[d.mon]
defines the width of GRASS monitor, see also GRASS_HEIGHT.
GRASS_WISH
[d.m, nviz]
set wish shell name to override 'wish'.
GRASS_NO_GLX_PBUFFERS
[nviz]
set to any value to disable the use of GLX Pbuffers.
GRASS_NO_GLX_PIXMAPS
[nviz]
Set to any value to disable the use of GLX Pixmaps.

List of selected GRASS PNG driver environment variables

[ These variables control the function of the PNG driver ]
See PNG driver manual page for detailed list of the variables.

List of selected GRASS PS driver environment variables

[ These variables control the function of the PS driver ]
See PS driver manual page for detailed list of the variables.

List of selected HTMLMAP driver environment variables

[ These variables control the function of the HTMLMAP driver ]
See HTMLMAP driver manual page for detailed list of the variables.

List of selected GRASS environment variables for direct rendering

[ In addition to those which are understood by the PNG driver, the following variables affect direct rendering. ]
GRASS_RENDER_IMMEDIATE
tells the raster library to use its built-in PNG/PS driver rather than connecting to an external monitor process using sockets. If GRASS_RENDER_IMMEDIATE=TRUE is set, there is no need to run d.mon start=PNG.
GRASS_FONT
specifies the font as either the name of a font from $GISBASE/etc/fontcap (or alternative fontcap file specified by GRASS_FONT_CAP), or alternatively the full path to a FreeType font file.
GRASS_ENCODING
the encoding to be assumed for text which is drawn using a freetype font; may be any encoding know to iconv.

List of selected internal GRASS environment variables

[ These variables are intended for internal use only by the GRASS software to facilitate communication between the GIS engine, GRASS scripts, and the GUI. The user should not set these in a GRASS session. They are meant to be set locally for specific commands. ]
GRASS_OVERWRITE
[all modules]
toggles map overwrite. This variable is automatically created by g.parser so that the --overwrite option will be inherited by dependent modules as the script runs. Setting either the GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed below will cause maps with identical names to be overwritten.
GRASS_VERBOSE
[all modules]
toggles verbosity level This variable is automatically created by g.parser so that the --verbose or --quiet flags will be inherited by dependent modules as the script runs.
GRASS_REGION
[libgis]
override region settings, separate parameters with a ";". Format is the same as in the WIND region settings file. Otherwise use is the same as WIND_OVERRIDE.
WIND_OVERRIDE
[libgis]
it causes programs to use the specified named region (created with e.g. g.region save=...) to be used as the current region, instead of the region from the WIND file.

This allows programs such as gis.m to run external commands on an alternate region without having to modify the WIND file then change it back afterwards.

List of selected GRASS gisenv variables

[ Use g.gisenv to get/set/unset/change them ]
DEBUG
[entire GRASS]
sets level of debug message output (0: no debug messages)
g.gisenv set=DEBUG=0
WX_DEBUG
[wxGUI]
sets level of debug message output for wxGUI (0: no debug messages, 1-5 debug levels)
DM_FORM_MODE
[d.m]
sets default form mode (txt or gui)
GISDBASE
initial database
GIS_LOCK
lock ID to prevent parallel GRASS use, process id of the start-up shell script
GRASS_DB_ENCODING
[d.what.vect/forms library]
encoding of query form (utf-8, ascii, iso8859-1, koi8-r)
GRASS_GUI
either text or gui to define non-/graphical startup.
Can also specify the name of the GUI to use, e.g. tcltk (gis.m), oldtcltk (d.m) or wxpython (wxGUI). Also exists as a shell environment variable. If this shell variable exists at GRASS startup, it will determine the GUI used. If it is not defined startup will default to the last GUI used.
LOCATION
full path to location directory
LOCATION_NAME
initial location name
MAPSET
initial mapset
OVERWRITE
[all modules]
toggles map overwrite. This variable is automatically created by g.parser so that the --overwrite option will be inherited by dependent modules as the script runs. Setting either the GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed below will cause maps with identical names to be overwritten.

GRASS-related Files

$HOME/.grassrc6
stores the GRASS variables (but not environment variables)
$HOME/.grasslogin6
stores the DBMI passwords in this hidden file. Only the file owner can access this file.
$HOME/GIS_ERROR_LOG
if this file exists then all GRASS error and warning messages are logged here. Applies to current user. To generate the file, use: touch $HOME/GIS_ERROR_LOG
See also GIS_ERROR_LOG variable.

SEE ALSO

Display drivers g.gisenv, g.parser

Last changed: $Date: 2013-04-24 03:55:08 -0700 (Wed, 24 Apr 2013) $


Help Index

© 2008-2012 GRASS Development Team