I recently had need to get an server’s console application up and running on my screen so I could do what I needed to do. It had been a while since I had done this, and the first time on OSX. I’m running OSX 10.9 Mavericks, and Apple has not shipped an X server with OSX since 10.5 Leopard. So what does one do given this situation? Here is the list of things you want to do:
On the remote server:
- Set up your display environment variable for X, where 111.222.333.444 is the IP of your OSX computer. Its probably a good idea to append this to your .bashrc command shell initialization file.
- Create an .Xauthority file by issuing a similar command as seen below. Substitute each of the Xs with a hexidecimal digit. The entire command argument should be exactly 32 bytes.:
xauth add 111.222.333.444:0 . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
On your local OSX computer:
- Download and install the open source X server, XQuartz.
- Open a tcp port range in your router: 6000-6063
- Go into System Preferences > Security & Privacy > Firewall and allow XQuartz to accept incoming connections
- Run an xterm, and inside the xterm issue the command: xhost +
- Connect to the remore server using ssh using the -X option:
ssh -X 555.666.777.888 -l yourlogin
After you ssh into the remote server you should be ready to run your remote X app and have it display on your local OSX computer’s desktop. Simply run the application you want from the command line. For example: