8/27/2021
84

The installer will prompt you to log off, then back on, to make XQuartz your default X11 server. Make sure the 'reopen windows when you log back in' box is checked, so your terminal and these instructions will reappear when you log back in. In the terminal, execute this command: defaults write org.macosforge.xquartz.X11 wmffm -bool true. To start XQuartz, use Spotlight to locate XQuartz or navigate to your Applications-Utilties folder and open XQuartz from there. XQuartz will start, and after about 5 seconds, an xterm will appear. This xterm works similarly to the Terminal application you have used previously to connect to the CS lab machines: 3.

  1. Xquartz Macports
  2. X11 For Mac
  3. Xquartz Macos Big Sur

You may not realize it, but your Mac already runs a variant of UNIX. You can easily access a terminal window to use your computer's built-in UNIX functionality with the 'Terminal' program (Applications/Utilities/Terminal.app). You may want to make a shortcut to this program in your Dock, since you'll be using it a lot from now on. Similarly, you can use your Mac directly to log into a UNIX server, and even to transfer files to/from a UNIX server.

Enabling X11-Forwarding (Popping up windows from the UNIX server)

Your Mac comes with another program that enables you to display graphics from programs running on a remote UNIX/Linux server, called 'XQuartz' (Applications/Utilities/XQuartz.app). On older OS X systems this program was called 'X11' and was located in essentially the same location. If neither of these programs are currently installed on your Mac, you can download XQuartz from the Mac App Store (free).

To enable forwarding, just run XQuartz/X11 before starting Terminal. If a xterm window pops up from XQuartz/X11, you may close that window before starting Terminal, since Terminal is more feature-rich than XTerm (my opinion). Once XQuartz/X11 is running, when you log into remote UNIX servers (as shown in the next section) you should be able to display remote graphics.

Logging into an UNIX server

The standard protocol for logging into a modern UNIX server is through using a Secure SHell (SSH) client. OS X has built-in SSH functionality, through the 'ssh' command in the Terminal.

To use ssh from the Terminal:

  • Open Terminal.
  • At the command line, type
    ssh username@hostname -CY
    or
    ssh username@hostname -CX
    (the Y vs X difference is minimal, and will not affect your user experience, just remember to use one of them). Here, username is your user name on the UNIX server, and hostname is the name of the UNIX server. For example, I could log into the UNIX server titan.smu.edu with the command
    ssh [email protected] -CY

For additional information on using ssh, type

Xquartz Macports

man ssh

(short for manual) in the Terminal window.

X11 For Mac

Transferring files to and from a UNIX server (terminal)

You may copy files to and from a UNIX/Linux server in the Terminal window as well, using the 'scp' command. The syntax is either

scp file_to_copy_from username@hostname:file_to_copy_to

or

Xquartz On Mac
scp username@hostname:file_to_copy_from file_to_copy_to

Xquartz Macos Big Sur

depending on whether you want to copy the file to or from the UNIX server. For example, suppose I have a file named 'file1' in my home directory on titan, and I want to copy it to the current directory on my Mac (the one the terminal is in, type 'pwd' to see which directory you are in if unsure):

scp [email protected]:file1 .

or

scp [email protected]:file1 file1

would give the desired result. Suppose now that I have the file 'file2' in the current directory on my Mac that I want to copy to my home directory on titan:

scp file2 [email protected]:

or

scp file2 [email protected]:file2

would do the trick. For more information on the 'scp' command, type man scp in the terminal.

Transferring files to and from a UNIX server (graphical)

Fetch

One of the most popular graphical file transfer options in OS X is the program Fetch. This is not a free program.

To use Fetch, fill in the UNIX hostname (e.g. titan.smu.edu), your username on that host (e.g. reynolds), and your password on that host, then click 'Connect'. You will then see a display of your remote directory on the UNIX server. Transfer files by dragging them to and from the Finder.

FileZilla

A free alternative to Fetch that may be used from OS X, Windows and Linux is is FileZilla. To install FileZilla in OS X:

  • Download the FileZilla client for Mac OS X from here.
  • Open the FileZilla installation file to unpack the application.
  • You may run Filezilla.app from the Desktop, or you can instead move it to your Applications folder.

To use FileZilla, fill in the fields for the host (e.g. titan.smu.edu), your username on that host (e.g. reynolds), your password, and the port (use 22 for SFTP), and hit [return]. You should notice two file browser windows open up, the browser on the left is on your computer, the browser on the right is from the UNIX host (e.g. titan). Transfer files by dragging them from one computer to the other with your mouse.

D.R. Reynolds, 28 August 2014

If you’ve ever thought about running Unix programs on your Mac, you might have assumed that meant you were stuck with the command-line interface. But you aren’t. Go to Leopard’s Applications: Utilities folder and double-click on X11.app. That will open xterm. At first, you might think it’s just another command-line tool like Mac OS X’s Terminal. But xterm is actually a gateway to something much bigger: the X11 graphical computing environment.

From X11 (which runs side by side with Mac OS X’s native Aqua environment), you can run a host of graphical Unix programs—applications that haven’t been fully ported to Mac OS X—as well as applications on remote Linux or Unix systems. Here’s a quick look at X11 and a few of the things you can do with it.

(Note: If you’re still running Tiger, you won’t find X11 installed by default; you’ll have to insert your Mac OS X install discs, run the Optional Installs package, and install it from there.)

Where to Get X11 Programs

The OS X install of X11 comes with a few programs of its own. For example, type /usr/X11/bin/xeyes & at the X11 command-line prompt, and you’ll open xeyes, a little program that puts a pair of animated eyes on your X11 desktop; move your cursor, and the eyes will follow it. Type /usr/X11/bin/xcalc &, and you’ll get an X11-based calculator. To get a list of the X11 programs that come with OS X, type ls /usr/X11/bin. You can then get more information about any of the programs listed there by typing man program name. That will summon the Unix manpage viewer and the text-only documentation for that program.

The X11 program that I most highly recommend is GIMP (GNU Image Manipulation Program). It’s a great image editor that’s actually comparable in some ways to Adobe Photoshop. If you download it from gimp.org, you’ll get a huge pile of source code that you’ll then have to build into an operable program. It’s far easier to download the GIMP binary from Wilbur Loves Apple. There, you’ll find GIMP 2.4.5 for both OS X 10.5 and 10.4 (Intel and PowerPC). Once you download that, you can just open the disk image and copy Gimp.app to your Applications folder.

While GIMP may be the best-known X11 program that will run on the Mac, there are hundreds of others worth checking out: Inkscape is a free vector-drawing program similar to Adobe Illustrator. If you want to run Microsoft Internet Explorer on your Intel Mac, you can do so with ies4osx, an X11-based application that uses the Wine Windows emulator to run any of four different versions of Explorer. (ies4osx uses a Mac-specific variant of Wine called Darwine, which is provided as a download on the ies4osx site along with ies4osx itself.)

Finally, if you really want to explore the world of X11 software, you can download and install either MacPorts or Fink. Both are open-source applications that attempt to catalog and help you install dozens of different X11 programs. But be warned: If you’re not familiar with the command line and Unix file management, don’t bother with either of them.

Different Interfaces

Whatever applications you want to try, you’ll notice immediately that they have their own look-and-feel, and it’s different from OS X’s.

For example, if you open GIMP, xcalc, and xeyes at the same time and then switch between them, you’ll notice that the X11 menu bar at the top of the screen remains the same no matter which application has the focus. If you can get used to not zipping up to the top of the screen to find a program’s menus, you should do just fine with X11.

Individual X11 programs often have menus and other interface elements of their own in addition to that overall X11 menu bar, and those elements aren’t consistent from one program to the next. For example, to open a menu in xterm, you control-click; other programs display their menus at the top of their own windows.

Other interface conventions vary in X11. For instance, most of the time you can highlight a text selection in an X11 application, and select Edit: Copy or press command-C to copy it. However, when you switch to another X11 program to paste in that selection, you’ll notice that the Edit: Paste menu item in X11’s global menu is grayed out; command-V won’t do anything. Instead, each X11 application uses its own pasting command. Most commonly, you’ll press the middle mouse button to paste; if your mouse doesn’t have three buttons, go to Preferences: Input, select Emulate Three Button Mouse, and follow the instructions.

Running X11 Remotely

If you have access to a remote Unix or Linux system (either in your office or on the Internet), you can connect to it via Secure Shell (SSH) and then run remote X11 applications that will display on your Mac’s desktop.

That done, try running an X11 application: xterm, xeyes, Firefox, or anything else that’s installed on the remote system. Depending on the speed of the connection, that application should open fairly quickly. If you get the message “error: Can’t open display: DISPLAY is not set,” this usually means the administrator of the remote computer needs to enable the X11 Forwarding option in the sshd_config file before you log in.

Brian Jepson is the executive editor of Make magazine’s book series and the coauthor of Mac OS X for Unix Geeks, fourth edition (O’Reilly, 2008).

Sequence diagram online. There are some tools that can do it automatically. In this particular sequence diagram there are only 3 (out of 4) actors shown. Those that play a role in this scenario. In complex cases drawing multiple sequence diagrams without all those alternate or optional fragments might be easier for readers.