Mathematica

I was totally new to Unix command lines and Mathematica, and some of these errors cost me a huge amount of time to finally solve. I have a bad habit that I don’t take notes for these “small” tricks. Then I have to repeat the searching process the next time I need them-_-. So I guess it’s a good idea for me to record them here for future use, aslo for others who have the same problems.

These notes are for X11 under OS X, but other platforms should be similar.

  • To avoid BadWindows errors, use -Y option instead of -X.
    ssh -Y -l user host
    Or you can edit /etc/ssh_config, and add the following two lines ot it:
    ForwardX11 yes
    ForwardX11Trusted yes

    The -X option is equivalent to the first line. The -Y option is equivalent to both.
  • To prevent Can’t Open Display errors, type following lines before attempting to run Mathematica:
    • On the local machine: xhost +remotemachinename
    • On the remote machine: setenv DISPLAY localmachinename:0

    If you don’t know your localmachinename or ip address, type the command “who”.

  • To prevent the Fonts error, there’re two methods you can use:
    • You can set a font server by typing the command:
      xset fp+ tcp/fontserver:7100
      If you don’t want to type this command every time you run Mathematica, you can edit the original version of “xinitrc” at /etc/X11/xinit/xinitrc or copy it to your home directory as an invisible file “.xinitrc” and edit that copy.
      Copy command: cp /etc/X11/xinit/xinitrc ~/.xinitrc
      Use “pico” to edit: pico .xinitrc
      Add these two lines:
      xset fp+ tcp/fontserver:7100
      xset fp rehash

      If you get a “Permission Denied” error, use command “chmod” to change the permission. For example, if you want to add writing permission to users, type
      chmod u+w file
    • Copy the font files to your local machine, repeat the steps to edit .xinitrc, the lines you need to add will be:
      xset fp+ /fontpath
      xset fp rehash
  • Some basic unix commands:
    • ls [-l] [-a]: To list the conents fo a directory.
    • mkdir: To create a new directory.
    • cp data1 data2: To create a copy of “data1” named “data2”.
      mv data1 data1.old: To rename a file “data1” to “data1.old”.
      mv data1 subdir: To move file “data1” into subdirectory “subdir”.
      rm data1: To delete file “data1”.
    • more: to view the content of a file.
    • pico or vi: to edit a file.
    • Email:
      • pine: email client.
      • For Dartmouth Northstar mail, to turn mail forwarding off:
        cp ~/.forward ~/.forward_dir/back
        unset noclobber
        echo > ~/.forward
        set noclobber

        To turn mail forwarding back on:
        cp ~/.forward_dir/back ~/.forward

————————
References:
[1]. Mathematica Technical Support
[2]. Dartmouth Research Computing
[3]. Princeton Help Desk
[4]. Mac OS X Emacs Digests