Enviroment Variables

MMA checks for enviroment variables when starting so it can modify seldom changed settings. The list is short, but will probably expand in the future to support arcane and unusual requests.

A variable can be set on the command line,

MMA_ENCODING=cp1253 mma mymmafile

or in a file (most likely .profile or .bashrc) which is read before you start your shell session.

All MMA environment variables start with the text MMA_ and a name. All the characters must be in uppercase only.

MMA_ENCODING
By default MMA uses cp1252 to encode input and output files. You can change this via the MMA_ENCODING environment variable. If it doesn't work, you are on your own.

MMA_LOGFILE=filename
Rather than printing errors and other runtime information to standard output (the terminal screen) this option sets a filename for saving the output. Note that if the file already exists it will be appended to (useful when you have multiple files to debug). FILENAME should be a normal file name understood by your operating system.

The file will only be created if there is output other than MMA PRINT statements. A header showing the date will be inserted at the top of the file.

The easy way to use this is with a command line like:

$ MMA_LOGFILE=abc mma test.mma

MMA_HOME=path
This variable will change the normal search MMA uses to set its home directory (here). Setting this environment variable inserts the path into the start of the normal search list.

MMA_LIBPATH=paths
A os-dependent list of separated list of paths or directories to prepend to the start of default library path list. Each item in the list is evaluated to process any “~” settings. For example:

$ MMA_LIBPATH=~/my/mma/dir:anotherDir mma test.mma

will set the $_PATHLIB to the list: ['/home/bob/my/mma/dir', 'anotherDir', '/home/bob/src/bv/mma/lib'].

When setting the added paths a quick check is done and any non-existent or non-directory names will be reported as warnings.

Note: The separator is a single character depending on your operating system. In Linux and Mac it is a “:” and in Windows it is a “;”. To verify, open a python session and type:
import os
print(os.pathsep)
The correct character will be printed.

In most cases you'll probably only have one path so you'll not need to worry about the separator.

MMA_INCPATH=paths
A list of paths or directories to prepend to the default include path list. See MMA_LIBPATH, above, for details.

MMA_PLUGPATH=paths
A list of paths or directories to prepend to the default plugin path list. See MMA_LIBPATH, above, for details.