This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Getting Started / Network SysAdmin Guide / Installation on Unix / Running Mathematica on Unix /

3.4.3 Initialization and Configuration

This section explains some of the key files installed by Mathematica, such as command scripts and command-line options, initialization file locations, configuration files, and fonts.

math

The math command starts the kernel from within a shell. This command is also used by the front end. The kernel is the part of Mathematica that handles calculations.

Command-Line Options

-initfile file. Specifies the name of a file containing commands to be run on startup.

-initpath dir. Takes as an argument a path to be searched for an initialization file called init.m.

-lmverbose. Prints diagnostic information to stderr on connecting to the license manager. This is useful for debugging problems related to the license server.

-mathlink. Specifies that the kernel should be run in MathLink mode.

-noinit. Specifies that no initialization file should be read at startup.

-password str. Specifies a password that can be used instead of a mathpass file. The password should have the form "machinename mathid licensenumber password".

-pwfile file. Specifies the name of a file that has a valid password.

-pwpath dir. Specifies a path to search for a mathpass file containing a valid password.

-run. Takes as an argument a command to be run on startup.

Earlier versions of the Mathematica kernel had a -record option that would allow all Mathematica sessions to be saved to a central record file. While this option is not present in Version 4.2 or later, you can create a central record file by using the following set of commands.

1. To the file $InstallationDirectory/Configuration/Kernel/init.m, add the following code.

AppendTo[$Echo, Private`Mrecord=OpenTemporary[]];

2. To the file $InstallationDirectory/Configuration/Kernel/end.m, add the following code.

If[ValueQ[Private`Mrecord],

Run[StringJoin["/usr/lib/sendmail mathrecord <",Private`

Mrecord[[1]]]]; DeleteFile[Private`Mrecord[[1]]];]

3. Add the following to the system file /usr/lib/aliases.

mathrecord: | "cat >> /usr/spool/mail/mathrecord"

4. Then run the command newaliases to rebuild the alias database.

mathematica

The mathematica command runs the X front end. In order for the front end to run, the DISPLAY environment variable must be set and the front end must be able to locate the fonts included with Mathematica. For a listing of front end resources, see Getting Started with Mathematica. This manual is also available online at reference.wolfram.com.

Command-Line Options

-appHelper. Combines the options -querySingleLaunch and -forceSaveAs. This option is typically used when configuring Mathematica as a helper application for web browsers.

-backgroundTaskDelay. Specifies the time the front end delays background tasks like PostScript rendering when waiting for input. The delay is measured in milliseconds and the default setting is 100.

-best. Asks the front end to use an optimal visual, depth, and colormap combination.

-cleanStart. Tells the front end to ignore caches stored in the user's preferences directory, $UserBaseDirectory/FrontEnd/5.0_Caches, and rebuilds the front end global preferences storage file, $UserBaseDirectory/FrontEnd/init.m. This option can also be abbreviated as -clean.

-copyright. Tells the front end to display copyright information from the command line.

-font f. Specifies the font the front end uses in menus, buttons, and so on. The X program xfontsel can be used to obtain a font name. The font name may be expressed either as an X Logical Font Description or as a valid font alias.

-forceSaveAs. Forces the front end to bring up the Save dialog box when closing a file passed to it on the command line. This option is typically used when configuring Mathematica as a helper application for web browsers.

-help. Prints a listing of all available command-line options.

-lmverbose. Prints diagnostic information to stderr on connecting to the license manager. This is useful for diagnosing problems related to the license server.

-mathlink. Causes the front end to run in MathLink mode. In MathLink mode, the front end runs as a child process that is capable of accepting MathLink packets. This option may be useful when the front end is used as a typesetting or graphics rendering service.

-noSplashScreen. Prevents the splash screen from being displayed on startup.

-nogui. Prevents the display of informational or error dialog boxes.

-nostderrWindow. Tells the front end not to display stderr messages in a pop-up window.

-nowatchCLIPBOARD. If specified, the X front end does not watch the CLIPBOARD property for change in ownership. The CLIPBOARD property allows items to be shared between X applications via copy and paste commands. If this option is specified, you can only paste items within Mathematica; items pasted into the CLIPBOARD from other applications are ignored.

-preferencesDirectory dir. Specifies the location where preferences are stored. By default this is set to ~/.Mathematica/FrontEnd.

-primaryModifierMask mask. Specifies the modifier mask to use as the command key. The default is Mod1Mask.

-printCommand command. Specifies a command for sending a file to the printer, such as lpr or lp. This command appears in the Print dialog box.

-pureKeys. Disables key bindings involving modifier keys that are defined by the operating system. This option may need to be given in order for some front end keyboard commands to work correctly. For example, some systems may reserve ControlKeyLeftModified6 RightModified for internal use and then the front end cannot use this to typeset superscripts. Key bindings involving the ShiftKey key are not disabled by this option.

-pwfile file. Specifies the name of a file containing a valid password.

-pwpath dir. Specifies a path to search for a mathpass file containing a valid password.

-querySingleLaunch. Brings up a dialog box to ask the user if a file specified on the command line should be opened in the currently running front end. The dialog box appears only if the current front end was also launched with the -querySingleLaunch option.

-screenXResolution. Specifies the horizontal screen resolution of the notebook display in dots per inch. For example, if the default screen resolution is 75 dpi, setting the option to 150 causes the contents of the notebook window to scale horizontally by a factor of two.

-screenYResolution. Specifies the vertical screen resolution of the notebook display in dots per inch. For example, if the default screen resolution is 75 dpi, setting the option to 150 causes the contents of the notebook window to scale vertically by a factor of two.

-secondaryModifierMask mask. Specifies the modifier mask to use as the option key. The default is Mod2Mask.

-singleLaunch. Allows only one copy of the front end per display. Multiple launches are prevented only if the currently running front end was launched with the -singleLaunch or -querySingleLaunch option.

-topDirectory dir. Specifies the directory in which Mathematica is installed. The default location is /usr/local/Wolfram/Mathematica/5.0.

-version. Prints the current version of the front end from the command line.

-visualChooser. Starts the front end by first putting up the Visual Chooser. This is a dialog box that allows you to specify system parameters such as visual ID, depth, and colormap.

-watchCLIPBOARD. Tells the front end to watch the CLIPBOARD property for change in ownership. This is the default. The CLIPBOARD property allows items to be shared between X applications. If this option is set, then you can paste items into Mathematica from other applications.

-wwwBrowser command. Specifies the command to execute when opening URL links from the front end. The command can include a %s format argument that is replaced with the URL.

mcc

The file mcc is a script for preprocessing and compiling MathLink source files. Information related to using mcc on various platforms is included in the online Help Browser in the front end. Click the Add-ons button in the Help Browser and browse through the topics under MathLink.

Configuration Files

Certain files are used to initialize Mathematica. Some files are used for both the front end and the kernel, and other files are specific to the executable. It is important to understand that initialization files stored in the $InstallationDirectory/Configuration directory, so any settings that should be shared by all users should be stored here. If a setting should only affect a particular user, then the initialization files stored in ~/.Mathematica should be changed to reflect the new setting.

Front End Files

$InstallationDirectory/Configuration/Licensing/mathpass. This file stores the password that enables the kernel and front end.

~/.Xdefaults or ~/.Xresources. This file stores the font choices, menu color choices, and other resources used by the front end. These are specific to each user.

~/.Mathematica/FrontEnd/Caches. This directory within the user's home directory stores information on system settings that are read by the front end.

~/.Mathematica/FrontEnd/init.m. This file defines settings within the front end, such as the listing of palettes, the options in the Option Inspector, and the list of files under the Notebooks submenu. The settings here override the systemwide settings set in $InstallationDirectory/Configuration/FrontEnd and are specific to each user.

$InstallationDirectory/Configuration/FrontEnd/init.m. Within the Mathematica directory, the Configuration/FrontEnd directory stores systemwide defaults used by all front ends run from the local machine. The init.m file defines settings within the front end, such as the listing of palettes, the options in the Option Inspector, the default location for files, and so forth. The settings stored here affect all users. If a special setting is needed for all front ends run from a particular machine, it is a good idea to open the front end as a user; make the necessary changes to palette listings, default file locations, and so forth; and then, after exiting the front end, move ~/.Mathematica/FrontEnd/init.m to this location.

Kernel Files

$InstallationDirectory/Configuration/Licensing/mathpass. This file stores the password that enables the kernel and front end.

$InstallationDirectory/Configuration/Kernel/init.m. This file is used to initialize the kernel and therefore should store any kernel commands that are appropriate for all users running the kernel on the local machine.

~/.Mathematica/Kernel/init.m. This file stores user-specific commands used to initialize the kernel.

User Home Configuration Files

For convenience, all the configuration files stored within a user's home directory are listed here. These files should be edited only to make changes that affect the user's local copy of Mathematica. To change preferences for all Mathematica users on the network, the files in the $InstallationDirectory/Configuration directory should be edited instead.

~/.Mathematica/FrontEnd/Caches. This directory within the user's home directory stores information on system settings that are read by the front end.

~/.Mathematica/FrontEnd/init.m. This file defines settings within the front end, such as the listing of palettes, the options in the Option Inspector, and the list of files under the Notebook submenu. The settings here override the systemwide settings set in $InstallationDirectory/Configuration/FrontEnd.

~/.Mathematica/Kernel/init.m. This file stores user-specific kernel commands that are used to initialize the kernel.

~/.Mathematica/Licensing/mathpass. While this is not normally the location for storing a system password, you may store a password in this location. It follows the same rules as the mathpass file listed in Section 1.4.2.

Fonts

BDF and Type1 fonts are installed by MathInstaller, but if your X server needs fonts in another format, you must copy over the fonts from the CD or convert the BDF fonts. Utilities such as bdftopcf or convertfont should already exist on your machine. Your license gives you permission to convert the fonts to an appropriate format for your X server.

Dealing with fonts under Unix can sometimes be tricky. The important issues in dealing with fonts in Mathematica are presented here for your convenience.

Font Installation

All machines that display the front end must have access to the fonts included with Mathematica. The fonts may be installed on a different machine than the one on which the Mathematica process runs. While the fonts are typically installed within the Mathematica directory structure, you may link fonts into one of the standard X directories. You have the option of copying the fonts to a standard X font directory, but this makes it more difficult to remove fonts later.

If you have a font family available in both outline and bitmap formats, the directory containing the outline font should appear first for optimal onscreen performance. Hence, $InstallationDirectory/SystemFiles/Fonts/Type1 should appear before $InstallationDirectory/SystemFiles/Fonts/BDF or $InstallationDirectory/SystemFiles/Fonts/PCF, whichever is installed for a given platform.

A typical command for adding the directory to the font path is as follows:

xset fp+ /usr/local/Wolfram/Mathematica/5.0/SystemFiles/Fonts/Type1

Remember to execute xset fp rehash to make the fonts available to the X server.

Most platforms only require the BDF bitmap fonts, but some platforms, such as HP Tru64 Unix's X server, support PCF instead of BDF. Some Windows-based X servers, for example SCO's XVision, require PCF fonts as well.

Font Servers

You may prefer not to install local copies of the Mathematica fonts on all machines. You can, instead, set up a font server with all the necessary Mathematica fonts. The other machines on the network can then find the fonts as needed by reading them from the Mathematica directory on the font server.

Common Font Errors

On some systems, the font path is limited in length, and it is possible to receive xset: bad font path element errors even if the fonts are available to the server. In this case, try reordering the font path and adding the directories for the Mathematica fonts earlier in the path. The directory $InstallationDirectory/SystemFiles/Fonts/Type1 must be listed before $InstallationDirectory/SystemFiles/Fonts/BDF on the font path for optimal onscreen performance.

Fonts and Printing

When the X front end prints a notebook, it uses AFM files for the font metrics needed for printing. If you want to print using a particular font not included with Mathematica, you will need the AFM files for the font. These files are installed in either $InstallationDirectory/Configuration/Fonts/AFM, /usr/lib/AFM, or /usr/lib/afm. Fonts are normally downloaded to the printer by the front end when printing. You may be able to download the fonts and store them on the printer. See the documentation and programs that came with your printer for more information.

PostScript Utilities

The psrender utility was located in $InstallationDirectory/Configuration/Installation/platform in Version 3. In Version 4 and later, the utility is located in $InstallationDirectory/SystemFiles/Graphics/Binaries/platform. The psrender utility converts the abbreviated PostScript produced by the Mathematica front end or kernel into a format appropriate for another device. It is automatically invoked by Mathematica via the kernel command Display, but it can be run from the command line. It replaces rasterps from Version 2.2.

You can make your own PostScript fonts available to psrender using the following procedure:

1. In your font directory, run the makepsres command. This creates the PSres.upr file required by psrender.

% makepsres -d

2. In the init.m file located in $InstallationDirectory/Configuration/Kernel, add the font directory to the kernel's font path.

Append[System`Dump`$FontPath,

ToFileName[{$RootDirectory, dir, ..., subdir}] ]

Here, the list {$RootDirectory, dir, ..., subdir} should represent the location of the font directory. For example, /usr/lib/X11/fonts would be written as {$RootDirectory, "usr", "lib", "X11", "fonts"}.

If you want to view Mathematica graphics using GhostScript, you need to make GhostScript aware of the Mathematica fonts. Contact Technical Support for more information, or check the Technical Support website at support.wolfram.com/export/graphics/ghostscript.html.