Quick Tip: Forwarding X11 to OS X

Just because you are on a Mac doesn't mean you can't run your Linux applications. Here's how you can bring penguin power to your Mac.

Every now and then I feel the need to spark up an application from my Linux machine and view it on my Mac laptop. The process is quite simple -- I just always forget it and end up trawling through search results for it.

Prerequisites:

  • X11 for Mac -- this package provides an X server for the Mac, while not completely integrated into the desktop it's "good enough".
  • 1 Linux box with an X server installed
First up we need to adjust the sshd configuration on the Linux box, typically found at /etc/ssh/sshd_config, and add the following line to allow X forwarding to occur over ssh:
X11Forwarding yes
Next we need to add an entry into the allowable X hosts on the Mac. The best way to do this is to start X11.app found in /Applications/Utilities, when the xterm appears type into it:
xhost +[ip address of linux box]
Now we can ssh from the mac into our Linux box with the -X flag that will set the DISPLAY variable in the ssh session :
ssh -X [user]@[ip address of linux box]
Once you have successfully logged in, you can start X apps from the ssh session and they will appear on the Mac.
Be aware though, even though X was built for networks, modern applications love of bitmaps and bling can be incredibly slow over the net -- it's pretty usable on a local network though.

Now next time xf86-input-evdev +dbus + hal-info makes your wireless mouse move only in the vertical direction, you can still use Evolution for your mail albeit from another machine.