This page has information for students and others who want to use Macintosh computers to access Unix systems or to do Java programming at Amherst. Topics addressed below include:
- Connecting to a Unix server
- Copying files to and from a Unix server
- Creating aliases on a Mac
- Doing Java programming directly on a Mac
Connecting to a Unix server
A good way to connect from a Mac is X11.
Copying files to and from your Mac
Two ways to copy files are described on the page on transferring files. There's another way too...
Create a terminal window that is connected to the Mac but not to the Unix machine. In other words, don't use SSH in that window. Recall that the Mac is really based on Unix. This means that you can issue "cd" commands within the terminal window to move around your directory structure. Begin by moving to the directory that 1) contains a directory or files that you want to move to the Unix system, or 2) is the place into which you want to move a directory or files.
To copy a whole directory into your current one, use the command
scp -r you@romulus.amherst.edu:dirname .
where dirname is a path name relative to your home directory on romulus, e.g. cs12/lab3. Note the period at the end of the line. Do use it; it means "the current directory". In other words, you're copying from a place on romulus to the current directory on your current machine.
To copy a whole directory the other direction, use
scp -r theDir you@romulus.amherst.edu:dirname
This copies theDir into dirname. Again, dirname should be a (potential long) directory name that is relative to your home directory on the Unix system.
To copy a single file to your Mac, use something like
scp you@romulus.amherst.edu:cs12/lab3/filename .
To go the other way, use
scp filename you@romulus.amherst.edu:cs12/lab3
To copy multiple files to your Mac, use something like
scp 'you@romulus.amherst.edu:cs12/lab3/*.java' .
To go the other way, use
scp *.java you@romulus.amherst.edu:cs12/lab3
Creating shortcuts
It's possible to set up an alias so that you can simply type "romulus" in a terminal window to make an SSH connection to romulus. Here's what's involved.
Determine which "shell" you are using on the Mac
Issue the command
echo $shell
in a terminal window for the Mac. If it says "/bin/tcsh", you can skip the next step.
If necessary, change your shell
Issue the command
chpass -s /bin/tcsh
Edit your .cshrc file
Type the command
emacs ~/.cshrc
Enter the lines
alias romulus ssh -Y you@romulus.amherst.edualias remus ssh -Y you@remus.amherst.edu
Then type CTRL-X CTRL-C to save the file. Close your terminal windows and exit the X11 application. Restart the X11 application. You should be able to type "romulus" or "remus" in a Mac terminal window to open a connection to the given machine.
Doing Java programming on the Mac
You can develop Java programs right on the Mac: just type your usual commands in a Mac terminal window but not in an SSH session. You'll need to download the Java Development Kit. (Try a web search for "jdk netbeans", which will lead you to a download that includes the NetBeans IDE. The current JDK, as of this writing, is JDK 8.) You might also want to download a flexible version of emacs, called aquamacs, from aquamacs.org.