Running Matlab on FreeBSD

Matlab supports Linux, and FreeBSD can run Matlab under Linux emulation. This page documents what I had to do to get Matlab version 5.3 running under FreeBSD. This worked on FreeBSD 3.1-RELEASE; I suspect it will work on most versions of FreeBSD as long as the Linux emulation is up to snuff.

Install

The install script looks for tar in /bin/tar, so create a symbolic link
cd /bin
ln -s /usr/bin/tar .
The install scripts also look for a /bin/uname binary that returns Linux when called with no arguments, and the Linux version number when called with the -r flag. Create a shell-script named /bin/uname with the following in it:
#!/bin/sh

if [ $# -eq 0 ]
then
  echo Linux
else
  echo 2.0.34
fi
This will make the install believe you're running the right Linux version. Copy your license file to $MATLAB/etc/license.dat, where $MATLAB refers to the root directory for your Matlab installation (normally /usr/local/matlab).

Now you can run the install scripts. Mount each Matlab CD and run the install script. My cdrom drive is /dev/acd0c (ATAPI IDE cdrom), and I did the following for each Matlab install cd (as root):

mount_cd9660 /dev/acd0c /mnt
cd /mnt
./install
cd /
umount /mnt
When you're done, delete the /bin/uname script as well as the symbolic link to /usr/bin/tar.

Running Matlab

Change the occurrences of /bin/uname to /usr/bin/uname in $MATLAB/bin/util/arch.sh. In the same script, change the lines:
Linux)
  Arch="lnx86"
  ;;
to
Linux|FreeBSD)
  Arch="lnx86"
  ;;
In general, do everything else as the instructions suggest.

Good luck! :)


Update (3/30/2005). I was informed that these instructions work with the current version of Matlab under FreeBSD 5.3 as well. Another issue that may arise is that the license.dat may have incorrect permissions. To fix this, use

chmod 644 /compat/linux/usr/local/matlab/etc/license.dat
Thanks to Kelly Black for pointing this out.
 
 
 
freebsd