Print this article Edit this article

MacOS X: Hosting and Accessing X11 Applications with OS X Tiger

OS X's UNIX-based environment makes it easy to execute both locally and remotely hosted X11 applications. It is also possible to access X11 applications using OS X from another OS X system. This FAQ explains how to host and access X11 applications using OS X 10.4 Tiger on both ends.

Host Setup

First we'll set up the machine hosting the X11 application. To start, edit the file /etc/sshd_config using a text editor like vi or pico. You will need to sudo into the editor to be able to save your changes. The command using pico would appear as such:

sudo pico /etc/sshd_config

Around line 80 you will find the line #X11Forwarding no. Uncomment that line by removing the pound (#) character and changing 'no' to 'yes'. The line should now read:

X11Forwarding yes

Save the file and exit the editor. We now need to restart the SSH process. This can be accomplished without leaving the Terminal. Use these two commands to restart the SSH process:

sudo service ssh stop
sudo service ssh start

More information on this step is available via Apple's Developer Connection.

Client Setup

Now that the host machine is set up properly, we will need to configure the client so that it can properly view the X11 application over SSH. Depending on what shell you are using, the name of the file we'll create (or append) will change. If you are using a bash shell, the file name is .bashrc. If you are using a csh shell, the file name is .cshrc. Both files should be stored in the root of your home directory. As an example, to create the file .bashrc in pico use the following command (sudo isn't necessary):

pico ~/.bashrc

For the bash shell, add the following environment setting, save the file and quit the editor:

export DISPLAY=localhost:0.0

If you are using a csh shell enter this setting, then save and exit:

if (! $?DISPLAY) then
setenv DISPLAY :0.0
endif

The next step is to edit /etc/sshd_config in the same manner as on the host. Edit the file (remember sudo!) add change the same text (found on line 80) so it appears as seen here:

X11Forwarding yes

Lastly, we'll restart SSH with the following two commands:

sudo service ssh stop
sudo service ssh start

Now, when you connect to the host, all you have to do is use the -Y flag to indicate that you're initiating an SSH session with X11 forwarding. (When using Panther, use the -X flag instead.)

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: Oct 9, 2007 1:37 pm GMT-4 by admin
JumpURL: