General Variables
Here is an alphabetical list of environment variables that have special meanings in Emacs. Most of these variables are also used by some other programs. Emacs does not require any of these environment variables to be set, but it uses their values if they are set.
- CDPATH
- Used by the
cdcommand to search for the directory you specify, when you specify a relative directory. - COLORTERM
- If this variable is set to the value
truecolor, it tells Emacs to use 24-bit true color on text-mode displays even if the terminfo database is not installed. Emacs will use built-in commands to request true color by RGB values instead of the missing terminfo information. - DBUS_SESSION_BUS_ADDRESS
- Used by D-Bus when Emacs is compiled with it. Usually, there is no need to change it. Setting it to a dummy address, like
unix:path=/dev/null, suppresses connections to the D-Bus session bus as well as autolaunching the D-Bus session bus if not running yet. - EMACSDATA
- Directory for the architecture-independent files that come with Emacs. This is used to initialize the variable
data-directory. - EMACSDOC
- Directory for the documentation string file, which is used to initialize the Lisp variable
doc-directory. - EMACSLOADPATH
- A colon-separated list of directories(Here and below) to search for Emacs Lisp files. If set, it modifies the usual initial value of the
load-pathvariable (Lisp Libraries). An empty element stands for the default value ofload-path; e.g., usingEMACSLOADPATH"/tmp:"= adds/tmpto the front of the defaultload-path. To specify an empty element in the middle of the list, use 2 colons in a row, as inEMACSLOADPATH"/tmp::/foo"=. - EMACSPATH
- A colon-separated list of directories to search for executable files. If set, Emacs uses this in addition to
PATH(see below) when initializing the variableexec-path(Shell). - Your email address; used to initialize the Lisp variable
user-mail-address, which the Emacs mail interface puts into theFromheader of outgoing messages (Mail Headers). - ESHELL
- Used for shell-mode to override the
SHELLenvironment variable (Interactive Shell). - HISTFILE
- The name of the file that shell commands are saved in between logins. This variable defaults to
~/.bash_historyif you use Bash, to~/.sh_historyif you use ksh, and to~/.historyotherwise. - HOME
- The location of your files in the directory tree; used for expansion of file names starting with a tilde (
~). If set, it should be set to an absolute file name. (If set to a relative file name, Emacs interprets it relative to the directory where Emacs was started, but we don't recommend to use this feature.) If unset,HOMEnormally defaults to the home directory of the user given byLOGNAME,USERor your user ID, or to/if all else fails. On MS-DOS, it defaults to the directory from which Emacs was started, with/binremoved from the end if it was present. On Windows, the default value ofHOMEis theApplication Datasubdirectory of the user profile directory (normally, this isC:/Documents and Settings//username//Application Data, where username is your user name), though for backwards compatibilityC:/will be used instead if a.emacsfile is found there. - HOSTNAME
- The name of the machine that Emacs is running on.
- INFOPATH
- A colon-separated list of directories in which to search for Info files.
- LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME, LANG
- The user's preferred locale. The locale has six categories, specified by the environment variables
LC_COLLATEfor sorting,LC_CTYPEfor character encoding,LC_MESSAGESfor system messages,LC_MONETARYfor monetary formats,LC_NUMERICfor numbers, andLC_TIMEfor dates and times. If one of these variables is not set, the category defaults to the value of theLANGenvironment variable, or to the defaultClocale ifLANGis not set. But ifLC_ALLis specified, it overrides the settings of all the other locale environment variables. On MS-Windows and macOS, ifLANGis not already set in the environment, Emacs sets it based on the system-wide default. You can set this in the ``Regional Settings'' Control Panel on some versions of MS-Windows, and in the ``Language and Region'' System Preference on macOS. When running a GUI session on Android,LANGis set to a fixed value, but the language and locale environment is derived from the system's ``Languages & Input'' preferences. Android Environment. The value of theLC_CTYPEcategory is matched against entries inlocale-language-names,locale-charset-language-names, andlocale-preferred-coding-systems, to select a default language environment and coding system. Language Environments. - LOGNAME
- The user's login name. See also
USER. - The name of your system mail inbox.
- MH
- Name of setup file for the mh system. MH-E.
- NAME
- Your real-world name. This is used to initialize the variable
user-full-name(Mail Headers). - NNTPSERVER
- The name of the news server. Used by the mh and Gnus packages.
- ORGANIZATION
- The name of the organization to which you belong. Used for setting the
Organization:header in your posts from the Gnus package. - PATH
- A colon-separated list of directories containing executable files. This is used to initialize the variable
exec-path(Shell). - PWD
- If set, this should be the default directory when Emacs was started.
- REPLYTO
- If set, this specifies an initial value for the variable
mail-default-reply-to(Mail Headers). - SAVEDIR
- The name of a directory in which news articles are saved by default. Used by the Gnus package.
- SHELL
- The name of an interpreter used to parse and execute programs run from inside Emacs. This is used to initialize the variable
shell-file-name(Single Shell). - SMTPSERVER
- The name of the outgoing mail server. This is used to initialize the variable
smtpmail-smtp-server(Mail Sending). - TERM
- The type of the terminal that Emacs is using. This variable must be set unless Emacs is run in batch mode. On MS-DOS, it defaults to
internal, which specifies a built-in terminal emulation that handles the machine's own display. - TERMCAP
- The name of the termcap library file describing how to program the terminal specified by
TERM. This defaults to/etc/termcap. - TMPDIR, TMP, TEMP
- These environment variables are used to initialize the variable
temporary-file-directory, which specifies a directory in which to put temporary files (Backup). Emacs tries to useTMPDIRfirst. If that is unset, Emacs normally falls back on/tmp, but on MS-Windows and MS-DOS it instead falls back onTMP, thenTEMP, and finallyc:/temp. - TZ
- This specifies the default time zone and possibly also daylight saving time information. Time Zone Rules. On MS-DOS, if
TZis not set in the environment when Emacs starts, Emacs defines a default value as appropriate for the country code returned by DOS. On MS-Windows, Emacs does not useTZat all. - USER
- The user's login name. See also
LOGNAME. On MS-DOS, this defaults toroot. - VERSION_CONTROL
- Used to initialize the
version-controlvariable (Backup Names).