COMP1911 17s1 Home Computing Advice for COMP1911 Mac Users Introduction to Programming

Overview

There are two main ways you can write code from your own computer:

If you don't have much experience and will have an internet connection avaiable, we recommend you start out with Connecting to CSE from macOS.

If you won't have an internet connection available and want to try working directly on your own computer, have a look at Writing + Compiing code on macOS.

Connecting to CSE from macOS

You have two options to connect to CSE from your personal computer:

ssh: connect to a CSE terminal

  1. 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.
  2. Click on the terminal window and type
    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)

  3. 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 eto transfer files to and from your CSE account.

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

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.
  2. Downloading Xcode (about 4.5GB) from the Mac App Store.

    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.

  3. Downloading only the command line tools from the "Download for Apple Developers" page on the Developer website.

    Log in with your Apple ID, then search and download the Command Line Tools package for your installed version of OS X.

For older versions of macOS X, only the last option works.