---
title: "Environment Variables"
canonical: "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/environment-variable.html"
source: "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/environment-variable.md"
part: "The Magma Language"
chapter: "Environment and Options"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "The Magma Language", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/index-magma-language.md"}
  - {"title": "Environment and Options", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/index-environment-and-options.md"}
prev: {"title": "Command Line Options", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/command-options.md"}
next: {"title": "Set and Get", "source": "https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/Set-Get.md"}
intrinsics:
  - {"name": "MAGMA_STARTUP_FILE", "signature": "MAGMA_STARTUP_FILE"}
  - {"name": "MAGMA_PATH", "signature": "MAGMA_PATH"}
  - {"name": "MAGMA_MEMORY_LIMIT", "signature": "MAGMA_MEMORY_LIMIT"}
  - {"name": "MAGMA_LIBRARY_ROOT", "signature": "MAGMA_LIBRARY_ROOT"}
  - {"name": "MAGMA_LIBRARIES", "signature": "MAGMA_LIBRARIES"}
  - {"name": "MAGMA_SYSTEM_SPEC", "signature": "MAGMA_SYSTEM_SPEC"}
  - {"name": "MAGMA_USER_SPEC", "signature": "MAGMA_USER_SPEC"}
  - {"name": "MAGMA_HELP_DIR", "signature": "MAGMA_HELP_DIR"}
  - {"name": "MAGMA_TEMP_DIR", "signature": "MAGMA_TEMP_DIR"}
  - {"name": "MAGMA_NO_HISTORY", "signature": "MAGMA_NO_HISTORY"}
  - {"name": "MAGMA_CONFIG_DIR", "signature": "MAGMA_CONFIG_DIR"}
  - {"name": "MAGMA_HIST_PLAIN", "signature": "MAGMA_HIST_PLAIN"}
---

<a id="environment-variable"></a>
<a id="sec-environment-variable"></a>
# Environment Variables

This section lists some environment variables used by Magma. These variables are set by an appropriate operating system command and are used to define various search paths and other run-time options.

<a id="literal-literal-magma-startup-file-magma-startup-file"></a>
## `MAGMA_STARTUP_FILE`

The name of the default start-up file. It can be overridden by the `magma -s` command.

<a id="literal-literal-magma-path-magma-path"></a>
## `MAGMA_PATH`

Search path for files that are loaded (a colon separated list of directories). It need not include directories for the libraries, just personal directories. This path is searched before the library directories.

<a id="literal-literal-magma-memory-limit-magma-memory-limit"></a>
## `MAGMA_MEMORY_LIMIT`

Limit on the size of the memory that may be used by a Magma-session (in bytes).

<a id="literal-literal-magma-library-root-magma-library-root"></a>
## `MAGMA_LIBRARY_ROOT`

The root directory for the Magma libraries (by supplying an absolute path name). From within Magma `SetLibraryRoot` and `GetLibraryRoot` can be used to change and view the value.

<a id="literal-literal-magma-libraries-magma-libraries"></a>
## `MAGMA_LIBRARIES`

Give a list of Magma libraries (as a colon separated list of sub-directories of the library root directory). From within Magma `SetLibraries` and `GetLibraries` can be used to change and view the value.

<a id="literal-literal-magma-system-spec-magma-system-spec"></a>
## `MAGMA_SYSTEM_SPEC`

The Magma system spec file containing the system packages automatically attached at start-up.

<a id="literal-literal-magma-user-spec-magma-user-spec"></a>
## `MAGMA_USER_SPEC`

The personal user spec file containing the user packages automatically attached at start-up.

<a id="literal-literal-magma-help-dir-magma-help-dir"></a>
## `MAGMA_HELP_DIR`

The root directory for the Magma help files.

<a id="literal-literal-magma-temp-dir-magma-temp-dir"></a>
## `MAGMA_TEMP_DIR`

Optional variable containing the directory Magma is to use for temporary files. If not specified, this defaults to `/tmp` (on Unix-like systems) or the system-wide temporary directory (on Windows systems).

<a id="literal-literal-magma-no-history-magma-no-history"></a>
## `MAGMA_NO_HISTORY`

If this variable is set to anything at all, Magma keeps no command history: no file is read, written, or made, and no directory either. Unlike the `history` option (Section [The Options File](https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/history-files.md#sec-options-file)), which is read from a file inside the history directory, it is checked before that directory is made.

<a id="literal-literal-magma-config-dir-magma-config-dir"></a>
## `MAGMA_CONFIG_DIR`

Optional variable naming a directory in which Magma keeps a persistent command history across sessions (Section [The History File](https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/history-files.md#sec-history-file)). The command lines typed in interactive sessions are saved there and reloaded in later sessions, and the directory may also hold an `options` file setting the history options (Section [The Options File](https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/history-files.md#sec-options-file)). It is created if it does not already exist.

If the variable is not set, Magma uses `~/.magma`, creating it if necessary, so a history is kept by default. To keep none, see `MAGMA_NO_HISTORY` above or the `history` option (Section [The Options File](https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/history-files.md#sec-options-file)).

<a id="literal-literal-magma-hist-plain-magma-hist-plain"></a>
## `MAGMA_HIST_PLAIN`

If this variable is set, the session browser (Section [Saved Sessions and the Browser](https://docs.magma-maths.org/v2.30-1/MagmaLanguage/EnvironmentAndOptions/history-files.md#sec-saved-sessions)) draws a plain, uncoloured display for this run, without editing the options file. Set to `dumb`, it also makes the browser emit no terminal escape sequences at all, as the `browser-plain dumb` option does. It can only make the display plainer than the `browser-plain` option asks for, never fancier.
