Dedicated to my late brave, beautiful and silly mummy, Debra Ross. I love you mumster.

Skip navigation

You're either viewing an archived story, or an archived story. To view the latest posts, fling yourself over to the home page, or you can view the complete post index.
Whatever you do, don't go here.

Tunneling X11 through SSH on Mac OS X

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

4 Comments

  1. teoman
    Posted 2008.08.16 at 01.45 | Permalink

    I could not quite get it to work.
    I have a machine running slackware connected to my local netowrk that is at 192.168.1.9

    I type
    ssh -X root@192.168.1.9
    and get
    root@192.168.1.9’s password:
    then it type the password and it freezes.

    I have a macbook pro laptop with osx 10.5.4
    X11 is supposed to be built in.

    Can you provide me with any pointers? Thank you

    Teoman

  2. Posted 2008.08.16 at 11.24 | Permalink

    That’s weird, from what I can tell you’ve entered everything in just fine.

    The default bundled version of X11 on Leopard is a bit iffy, people who use X11 seriously on OS X download the latest community build from MacOSForge…
    under the heading "Latest Release" click the latest version and download it.

    http://xquartz.macosforge.org/trac/wiki

    The X11 from this site is the one that ends up going into official Mac OS X updates, so they’re perfectly safe. Apple for some reason chooses not to release them through the regular software update client.

    Though I am a FreeBSD guy, Slackware is my Linux distro of choice :-)

  3. teoman
    Posted 2008.08.16 at 20.10 | Permalink

    Thank you, installing Xquartz did indeed help a bit. I noticed taht with the standard version I could not run xeyes on my computer. However I still get the following error messages when i try to run remote applications

    root@pinux:~# kedit
    kedit: cannot connect to X server
    root@pinux:~# xeyes
    Error: Can’t open display:

    I read stuff about changing the DISPLAY properties on my computer however that did not work. using:

    DISPLAY=:0.0
    export DISPLAY

    originally when I as for $DISPLAY I get
    /tmp/launch-0Txjwl/:0

    Any ideas why?

  4. Posted 2008.08.16 at 20.50 | Permalink

    That sucks :-(

    I can’t recall the site I read it on, but I do remember being told specifically NOT to define DISPLAY anywhere because the new Leopard X11 takes care of that automatically. Try removing all references, and remove X11.app from your Dock if its there too.

    The only thing I can think of is if you’ve upgraded from Tiger to Leopard instead of installing fresh, the settings for the Xfree86 version of X11 might be there still instead of Xorg. I had a similar problem, but installing Leopard fresh cleared it up.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
RichardDawkins.net