Using X11 to Access Unix from a Mac

Submitted on Thursday, 1/31/2019, at 11:32 AM

Students in introductory computer science classes work on two Unix systems, and The two machines are interchangable, so you can work on whichever one you want. In general you can refer to the machines by their short names when you are on-campus and by their full names, including the suffix, when you are off-campus.

Students in advanced classes may use systems managed by our own department.  Most of the ideas mentioned here can be applied equally well to our departmental systems.

One way to access the Unix systems is with X windows. When you use a connection of this kind, you have one or more windows to the other machine, which appear as part of your Mac desktop.

Getting X11 on your own Mac

X11 is preinstalled in older versions of OS X.  If you can't find it on your system, you should install XQuartz.

Let us know if you have problems getting X11 or XQuartz to work.

Connecting to the Unix machine

In the examples that follow, we'll suppose that you are trying to connect to romulus. Remus is accessed in precisely the same way.

Type the following in the terminal window that you got when you started X11:

ssh -Y 

By you, we mean your username. That will give you an initial terminal session on romulus. See the general information page for more info on what you can do in the window.


Once you have your first terminal window to the Unix server...

Create another one, the one in which you'll work, with the command

gnome-terminal &

In the new white window, you can begin to issue Unix commands. Here are some examples:

emacs &
gnome-terminal &
xeyes &

The emacs command runs the editor, the gnome-terminal command opens an extra terminal window, xeyes is a cool little graphical application, and ls lists the files in your directory.  The ampersand tells the terminal window that you would like to run the program "in the background," meaning that you can immediately issue more commands in the terminal window.

You should note that if you use the Applications menu of the X11 application and select Terminal, you'll get a new window in which you can issue commands to the Mac. You can use the SSH command in that window to make an additional connection to one of the Unix machines.

You can work on the client machine, too.

It's possible, of course, to switch between running Unix programs and using applications directly on your client machine. If you happen to close all of your terminal windows to your Unix machine, you can create a new terminal connection without closing and reopening the X windows application. See the Mac page for more information.

When you're done with your Unix session...

Simply exit each of your Unix applications, for example by using the Exit menu item in Unix or by typing "exit" in the terminal windows. You might get a complaint in a terminal window if you try to exit before the programs running in the background, i.e. the ones started with &, have been closed. You can then close X windows application.

If you're off-campus...

If you do use X windows, you may find it advantageous to run emacs, our text editor, directly within a terminal window. By avoiding using a separate window for emacs, you may find the editor to be a bit more responsive. The downside is that you'll need to use special emacs keycodes to do things within the window. The emacs tutorial will tell you more about the codes. Don't worry too much about trying this out right away, but it's worth remembering that there is a way to get more sprightly performance if you need it. To run emacs in the terminal window, issue the command

emacs -nw &

in a terminal window for a Unix machine.

Questions or suggestions on this page?

Send email to lamcgeoch or talk to any of the computer science faculty.