Wednesday, January 13, 2010

How to display mathematica on a local ubuntu machine

When I first ran mathematica, I got the following errors in the server machine.
xset: bad font path element (#23), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax

This problem can be solved very easily by doing the following in your local linux machine. This is what I did.


  1. Download and install mathematica fonts from
    here on your local machine.

  2. execute the following commands in local machine.
    xset fp+ /your_mathematica_fonts_directory/Fonts/Type1
    xset fp rehash

  3. ssh to your mathematica server using -X option and type mathematica at the command prompt.


  4. You can stop reading this blog at this point, because this is enough for you to go. However some interesting stuff is available below.

  5. Steps 2 and 3 must be executed every time you want to run mathematica.

  6. May be, you would prefer to write a script to do all this so that in one click you get into the server. My script (which I have named mathematica) is given below


  7. #!/bin/bash
    xset fp+ /your_fonts_directory/Fonts/Type1
    xset fp rehash
    ssh your_login_id@your_mathematica_server -X mathematica

  8. You may be wondering that you will need to type the server account password every time. You need not do that. If you follow the instructions in this link, you can set up an rsa public key and avoid typing password.

  9. Thus with the above steps, with a single command or click you can run mathematica on your ubuntu desktop !

  10. Enjoy

1 comment:

deccard said...

Worked with Lucid Ubuntu 10.04.

I First installed the Mathematica fonts by

# apt-get install mathematica-fonts

Then I found the installed fonts from

# /usr/share/fonts/type1/mathematica/

Then I ran locally the commands stated here:

# xset fp+ /usr/share/fonts/type1/mathematica/

# xset fp rehash

and got the Mathematica fonts working! Thank you!