Home Computing Advice for COMP1511 Mac Users

If you have an internet connection:
1. If you have an internet connection one easy way to use a Mac computer to work on COMP1511 is to connect to VLAB using instructions here

2. If you have an internet connection another good way to use a Mac computer to work on COMP1511 is via ssh using the instructions below.

3. If you don't have an internet connection:
4. If you won't have an internet connection available or want to try working directly on your own computer see the instructions further on for help

1. Connecting to CSE using VLAB

If you have an internet connection, one easy way to use a Mac computer to work on COMP1511 is to connect to VLAB using instructions here.

2. Connecting using Terminal on macOS

Open the Terminal application. This will give you a terminal window that runs on your own computer. This has access to the files and programs on your computer and you can use many of the same commands (such as ls, cd, rm, mkdir, and cat) that you can use on the CSE lab machines.

If the "Terminal" icon does not appear in the "dock", open the "Applications" folder, then the "Utilities" subfolder, and drag the Terminal icon into the dock. Then go to the dock and click on it. A terminal window should open.

In the terminal, you need to use the ssh command and tell it to connect to the CSE servers. to do this, enter the command below (make sure to use your own zID in place of your-zID):

ssh z5555555@login.cse.unsw.edu.au

replacing z5555555 with your zID. It should prompt you for your zPass. (Note: you should not expect dots or anything else to appear on the screen as you are typing your password)

You will then find that your terminal window is working from the CSE machines. If you use commands like pwd, cd, and ls, you will find all of the files that you can normally access from the CSE lab computers. You can also use all the programs and commands you would normally find on the CSE lab computers.

You can no longer see the files or use any of the programs on your own computer. To close the connection to the CSE lab computer, use the exit command.

BTW if you are using Linux on your own computer, you can follow these instructions using a terminal application installed on your computer, instead of the Terminal application that is found on OS X. To use graphical applications, you will need to run an X server.

If you are running a recent version of macOS (10.6 or later), you will need to install XQuartz. For macOS 10.5 Leopard or before, the X server X11 is already installed. Once the X server is installed, open the Terminal and type

ssh -Y z5555555@login.cse.unsw.edu.au

The -Y option means that whenever you open a window, the window will appear remotely on your home machine.

Editing Files on OSX

You can use any text editor, for example Text Wrangler, which can be downloaded from the Mac App Store.

Transferring Files to/from CSE on OSX

You can use scp to transfer files from your CSE account to the current directory on your local machine, type
scp z5555555@login.cse.unsw.edu.au:~/directory/filename .

The . is a convenient way to reference the current directory of the Terminal (this is true in any UNIX command line). You can replace the . above with the path to any directory on your local machine. Hint - If you drag a directory from the Finder into the Terminal window, the path to that directory is copied into the Terminal. To transfer the other way, type:
scp filename z5555555@login.cse.unsw.edu.au:~/directory
To transfer an entire directory and its contents, use the option -r which stands for recursive. For example, type:
scp -r z5555555@login.cse.unsw.edu.au:~/directory/directorytocopy .
Cyberduck is another program providing a graphical interface which can be used to transfer files to and from your CSE account.

Summary (all platforms) for transferring files to/from CSE here

3. Writing + Compiling code locally on macOS

To install the compiler gcc, you must install the Xcode command line developer tools. On newer versions of macOS (OS X 10.9 Mavericks and later), there are three ways to do this:
1. Using the Terminal to install only the command line tools (about 130MB). This is the recommended option for most students.

Type

xcode-select --install
into the Terminal, and then follow the Software Update prompts to complete the installation.

Xcode includes the command line developer tools, but also the Xcode IDE. Advanced students may wish to investigate using the Xcode IDE to write C code at a later stage in the course. Its code completion, automatic warnings and debugging features may be helpful when completing assignments. However it is recommended that all students be comfortable writing code in a simple text editor such as Gedit, because this will be the only option in the exam environment.

On the mac, the compiler used is slightly different to the one used in the lab and CSE. The main difference is to add a couple more flags to the gcc call, which are -Wall -Werror. Both of these perform some additional error checks in your code and automatically included inside dcc.
gcc -Wall -Werror -o myProg myProg.c