11.3. Installing Mathematica®

Updated for Mathematica 5.X by Boris Hollas.

This section describes the process of installing the Linux® version of Mathematica® 5.X onto a FreeBSD system. Mathematica® is a commercial, computational software program used in scientific, engineering, and mathematical fields. It is available from Wolfram Research.

11.3.1. Running the Mathematica® Installer

First, tell FreeBSD that Mathematica®'s Linux® binaries use the Linux® Application Binary Interface ABI. The easiest way to do this is to set the default ELF brand to Linux® for all unbranded binaries with the command:

# sysctl kern.fallback_elf_brand=3

FreeBSD will now assume that unbranded ELF binaries use the Linux® ABI which should allow the installer to execute from the CDROM.

Copy the MathInstaller to the hard drive:

# mount /cdrom # cp /cdrom/Unix/Installers/Linux/MathInstaller /localdir/

In this file, replace /bin/sh in the first line with /compat/linux/bin/sh. This ensures that the installer is executed by the Linux® version of sh(1). Next, replace all occurrences of Linux) with FreeBSD) using a text editor or the script below in the next section. This tells the Mathematica® installer, to treat FreeBSD as a Linux®-like operating system. Invoking MathInstaller should now install Mathematica®.

11.3.2. Modifying the Mathematica® Executables

The shell scripts that Mathematica® created during installation have to be modified before use. When using /usr/local/bin as the directory for the Mathematica® executables, symlinks in this directory will point to files called math, mathematica, Mathematica, and MathKernel. In each of these, replace Linux) with FreeBSD) using a text editor or the following shell script:

#!/bin/sh cd /usr/local/bin for i in math mathematica Mathematica MathKernel do sed 's/Linux)/FreeBSD)/g' $i > $i.tmp sed 's/\/bin\/sh/\/compat\/linux\/bin\/sh/g' $i.tmp > $i rm $i.tmp chmod a+x $i done

11.3.3. Obtaining a Mathematica® Password

When Mathematica® is started for the first time, it will ask for a password. If a password had not yet been obtained from Wolfram Research, run mathinfo in the installation directory to obtain the machine ID. This machine ID is based solely on the MAC address of the first Ethernet card, as the copy of Mathematica® cannot run on different machines.

When registering with Wolfram Research, provide the machine ID and they will respond with a corresponding password consisting of groups of numbers.

11.3.4. Running the Mathematica® Frontend over a Network

Mathematica® uses some special fonts to display characters not present in any of the standard font sets. Xorg requires these fonts to be installed locally. This means that these fonts need to be copied from the CDROM or from a host with Mathematica® installed to the local machine. These fonts are normally stored in /cdrom/Unix/Files/SystemFiles/Fonts on the CDROM, or /usr/local/mathematica/SystemFiles/Fonts on the hard drive. The actual fonts are in the subdirectories Type1 and X. There are several ways to use them, as described below.

The first way is to copy the fonts into one of the existing font directories in /usr/local/lib/X11/fonts then running mkfontdir(1) within the directory containing the new fonts.

The second way to do this is to copy the directories to /usr/local/lib/X11/fonts:

# cd /usr/local/lib/X11/fonts # mkdir X # mkdir MathType1 # cd /cdrom/Unix/Files/SystemFiles/Fonts # cp X/* /usr/local/lib/X11/fonts/X # cp Type1/* /usr/local/lib/X11/fonts/MathType1 # cd /usr/local/lib/X11/fonts/X # mkfontdir # cd ../MathType1 # mkfontdir

Now add the new font directories to the font path:

# xset fp+ /usr/local/lib/X11/fonts/X # xset fp+ /usr/local/lib/X11/fonts/MathType1 # xset fp rehash

When using the Xorg server, these font directories can be loaded automatically by adding them to /etc/X11/xorg.conf.

If /usr/local/lib/X11/fonts/Type1 does not already exist, change the name of the MathType1 directory in the example above to Type1.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.

Send questions about this document to <freebsd-doc@FreeBSD.org>.