(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); skip to primary navigationskip to content

Getting Started Mac Users

This page describes how to set up a VNC session on a MacOSX machine. It is confusingly different enough to windows that I thought the Mac should have its own page.

Before you start:

  1. Check you have X11 installed on your machine, if not go and get the installation disks and put it on.

  2. Download Chicken of the VNC http://sourceforge.net/projects/cotvnc/ which is a VNC viewer application written specially for the mac.

In order to get to a desktop screen you will first have to create it (if you haven't already got one running). Once a session/desktop is running you can then log into it with your VNC viewer.

Setting up a new VNC session

Note: You don't have to create a desktop every time you want to log in. Only if you've 'killed' your last one or want to create a second one.

The following is how to set up a VNC server session (ie your own BCNI network Desktop) that is unique to you. To do this you first need to logon to the BCNI server.

  • Open up an X11 terminal and at the command line type:

ssh abc01@bcni.psychol.cam.ac.uk (where abc01 is your own login)

and then enter your BCNI password when prompted. This will log you onto the 'gateway' machine which is called iron. Now you have to logon to one of the compute servers (bcni0, bcni1, bcni2, bcni3 or bcni4) in order to create your your VNC desktop.

  • At the command line, type: ssh bcni# where # is the number of the server you want to login to)

then enter your password when prompted. You are now logged into the specific server where you will start your desktop.

  • To start up a new VNC session type the following at the command line: vncserver -depth 24 -geometry 1280x1024

This will give you a desktop with 24-bit (i.e. good) colour, and a resolution of 1280 by 1024. If you use a larger or smaller screen resolution on your workstation, you should alter the above to match your resolution. You can check your screen resolution in the MacOSX System Preferences -> Displays.

NB: If this is the first time you have run the vncserver, it will ask you for a password. This will become the password for all your virtual desktops, and does not have to be the same as your BCNI network password but is easier to remember if it is.

The above command will create a new 'virtual desktop', and then output the information you will need to start up your VNC viewer so write it down on a bit of paper. Example output follows. Password: Verify: xauth: creating new authority file /home/abc01/.Xauthority New 'bcni3:2 (abc01)' desktop is bcni3:2 Starting applications specified in /home/abc01/.vnc/xstartup Log file is /home/abc01/.vnc/bcni3:2.log


Great! Now you have a session up and running and in this example it is on bcni3 has been called desktop 2. Now you need to 'tunnel' into this desktop and use your VNC viewer to see the screen. At this point you can log out of the X11 window you have open. Type exit to log out from the server and you should be back in iron, type exit again and you should be logged out of iron.

Accessing your VNC desktop

Login to the computer server

  • In your X11 terminal window login to iron with the following command: ssh abc01@bcni.psychol.cam.ac.uk -L 5901:bcni3:5902

enter the password when prompted.

Where 5901 is the local display (therefore can be any number between 5901-99), bcni3 is the compute server that you created your desktop on and 5902 is the desktop number that you were given. (Note that numbers are always of the form 59## here). This command sets up a link between your computer and the desktop on bcni3, which your VNC viewer will need.

Viewing your desktop

Now you're ready to open up Chicken of the VNC and do the following. Click the little 'add' button and name the session 'bcni' or bcni:abc01 or whatever. Leave the hostname as localhost and set the display number to the same as that you logged in with, in the above example it was 1 (but remember can be any number between 01-99)

Type your vncserver password in to the box and click save password, also check the allow other users box, just in case someone else needs to use your machine to login. Finally click connect. 

If all has worked then you should now have a new desktop window in front of you that is actually your desktop on one of the bcni linux computers. In our case we would be looking at desktop2 on bcni3.

To close the connection, just close or quit Chicken of the VNC and then exit from X11 terminal window as normal. If the session has been inactive for a while it will log you out automatically anyway. Even though the connection between your computer and the server is now lost, anything you've left running on your virtual desktop will continue to run (e.g a camba or matlab).

A slightly more advanced method

Setting up a VNCviewer - a quicker way

There are a couple of different ways of avoiding all the typing above but they involve messing about with Unix. Have a go if you feel confident. Below is one approach to saving time [but I'd recommend putting it in a separate file rather than the bash file - AmirMC]

So that you don't have to type ssh abc01@bcni.psychol.cam.ac.uk -L 5901:bcni3:5902 everytime you login or try and remember which server you are on you can set up an alias in your login file on your mac (http://en.wikipedia.org/wiki/Alias_(Unix_shell)). To do this open up an X11 terminal and then edit your .bashrc or .bash_profile or whatever login shell you are using and add the following line to it.** (see bottom of page for futher notes on editing hidden files)

alias vnc-bcni='ssh abc01@bcni.psychol.cam.ac.uk -L 5901:bcni3:5902'

then save the file and open a new X11 terminal and type vnc-bcni at the command line, enter your BCNI password when prompted.

Then open up Chicken of the VNC and click connect on your saved session and voila your BCNI network linux desktop pops up immediately.

The only time this needs to be repeated is if the BCNI network is re-booted for any reason. You will know this has happened because your Chicken of the VNC will complain or Ian has sent an email.

If you do have any further problems then the best thing is to 'kill' ([WWW] http://en.wikipedia.org/wiki/Kill_(Unix)) your existing vncserver and start a new one by re-tracing the steps above. Do this by logging in to the bcni server you originally set vncserver running and then type at the command line:

vncserver -kill :X

where X is your desktop number, as this removes the .pid file in your .vnc directory.

NB: Don't forget to change your alias.

**To avoid using the vim or emacs editor then do the following: type open -e .bashrc at the command prompt in your X11 window, this will open the hidden file in TextEdit which is a lot easier to use. You can also add the line alias Tedit='open -e' to your .bashrc file so that you need only type Tedit at the command line to open this application.