Connecting to Other X Window Systems

You can connect from Mac OS X to other X window systems using ssh with X11 forwarding. If you use OpenSSH (which is included with Mac OS X), you must use the -X option to request X11 forwarding (the -2 option specifies the ssh version 2 protocol, as opposed to the older version 1 protocol). For example:

ssh -2 -X remotemachine -l username

As long as XDarwin is running, this can be entered in either an xterm window or in the Mac OS X Terminal. To have the X11 forwarding enabled in Terminal, you must have the DISPLAY variable set prior to making the connection, as noted earlier. (This will always be the case if the DISPLAY variable is set in your .tcshrc script.) It is also possible to create a double-clickable application that connects to a remote machine via ssh2, with X11 forwarding enabled. For example, you can use the following script for this purpose:

#!/bin/sh 
ssh -2 -X remotemachine -l username

If you’ve installed the commercial version of ssh from http://www.ssh.com, the equivalent of the preceding script is as follows:

#!/bin/sh 
ssh2 remotemachine -l username

Tip

The X11 forwarding flag is +x with the commercial ssh, but it is enabled by default, so that you need not include it in the command.

Using OroborOSX, you can add a Launch menu item to accomplish the same task. To do this, start by copying the template file found in the directory ~/Library/Preferences/OroborOSX/Launch Menu Items to whatever you’d like to call this application. ...

Get Mac OS X for Unix Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.