How To: Installing MATLAB



Reaction score: 1
Messages: 37

I have collect in one text all the suggestions that I found useful to install MATLAB on BSD systems. I hope that this should help other people that could have had the same problem. Actually, sometimes, too many posts are more confusing than one that contains ALL the steps that one ctually needs to install Matlab. ;)

Installing MATLAB on BSD systems:

1) The computer misses the "sse2" flag that is not found in /compat/linux/proc/cpuinfo. This causes the failing of the installation. To avoid this problem the following patch must be used (

In the “install” program the line:

expr "`cat /proc/cpuinfo`" : '.* sse2 .*$'

has to be replaced by:

#expr "`cat /proc/cpuinfo`" : '.* sse2 .*$'
echo 1

2) to avoid further problems like

There was an unexpected exception. See the log file (/tmp/aws.log) for more details. (Jan 04, 2010 
12:58:56)java.lang.UnsatisfiedLinkError: /usr/compat/linux/usr/local/matlab/bin/glnx86/ cannot handle TLS data " (**)

the following changes must be applied:

-> Remove all linux* ports already installed with: pkg_delete linux

-> Add to /etc/sysctl.conf file the following line:

-> Matlab program probably also needs linprocfs mounted, so add to /etc/fstab file the following line:
linprocfs        /compat/linux/proc linprocfs               rw        0        0

-> Reboot.

-> Add to the file /etc/make.conf the following two lines


-> Install emulators/linux_base-f10
-> Install f10 versions of the linux* ports if you need them, e.g. instead of graphics/linux-png install graphics/linux-f10-png if you need it.

3) to avoid problems with (and related) do the following:

-> create the following symlink: ln -s ../usr/bin/expr /compat/linux/bin/expr

-> For the error about, check if you have the port x11/linux-f10-xorg-libs installed. If not, install it.

4) Now follow the instruction presented in:, limiting
to 10.5.1 and 10.5.2 paragraphs.

Now you have installed Matlab. Before running it you have to do some patches to avoid futher “SSE2 checking problems”. From, do the following steps:

-> In ldd and mexext files replace the word “Linux)” with “FreeBSD)”

-> In matlab file, replace #!/bin/sh with #!/usr/compat/linux/bin/sh

-> In mbuild and util/ files, add an echo 1 line after the cpuinfo/sse2 line.

Now, finally, you can run Matlab! Do not care of the error message that it display since the program runs correctly anyway.




Reaction score: 1
Messages: 37

thanks a lot

thank you very much for your help and excuse me for the problem that my inexperience has caused.

sorry again