Tunneling X11 through SSH on Mac OS X

Software

As I increasingly use and rely upon Unix-like operating systems such as FreeBSD (and GNU/Linux) on desktops, I tend to forget at times that I'm using a sophisticated server installed locally to generate my graphical environments, namely X11. And just as with any server I can call it up from another machine and use its services.

X11.app

X11 was built specifically to serve graphical applications over networks, and can still be used in this way by employing SSH on the client, and installing the desired applications on the server. My primary desktop is a DIY running FreeBSD 7.0 (more on my debacle with Debian GNU/Linux in a later post!), and my primary mobile machine is an original generation MacBook Pro.

USELESS ASIDE: Given the fact it’s about time for my half-yearly move back to Adelaide, Australia I’ve been contemplating how best to access my desktop machines here in Singapore using my MacBook Pro which I’ll be taking with me. These are the things that keep my up at night.

To access desktop applications on a remote Unix-like machine on your Mac, fire up your Terminal and use the regular SSH command, but with the -X flag:

% ssh -X [USERNAME]@[HOST MACHINE]
% Password: [PASSWORD]

Provided you have installed X11.app from either your Tiger or Leopard install DVD; or better yet downloaded the latest community build of Xquartz from MacOSForge; you should now be able to enter in the name of a graphical application and have it appear!

Tunneled FreeBSD X11 apps on Mac OS X
Tunneled FreeBSD X11 apps running on Mac OS X through SSH

For example, I entered % xfce4-panel and used that to launch some of my favourite apps, as you can see above. Over my local home gigabit Ethernet connection and even at Starbucks on the free Singapore public WiFi networks the applications felt like they were running on my local machine.

You may recognise the Xfce panel from my previous post on Xfce and Openbox. There's a reason for that; I'm using the panel remotely from the same machine. Ain't [computer] science wonderful?

Plus then you can do things like run local Mac applications and the remote X11 applications on the same screen:

Tunneled FreeBSD X11 apps on Mac OS X
Xfce's Thunar file manager compared to Leopard's Finder

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.