X forwarding over SSH from Mac to a Linux box

I need run Mac applications on a remote Mac machine and display it on a local Linux machine's X server (a lot of articles on the Internet seem to be detailing how would you do it the opposite way).

$ ssh -X mac-box
$ cd /Developer/Applications/Xcode.app
$ ./Contents/MacOS/Xcode
Sat Oct  3 20:41:26 mac-box.local Xcode[15634] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
^C
  1. My $DISPLAY variable appears to be empty. What should it look like so that forwarding works correctly?
  2. Can I run OSX applications this way at all?

If a Mac's Aqua was X, then you would not need to run X (XQuartz) to start other X programs on a Mac...

So: no, I think you cannot do this.


But, to help you get started, I'd first try to get true X programs forwarded to your Linux machine:

  • On your Mac: install XQuartz if you've not yet done so (like XQuartz 2.3.4 from optional installs on the OS X 10.6 DVD, or download the latest from the XQuartz project).

  • On your Mac: change X11Forwarding no into X11Forwarding yes (and ensure there's no hash (#) in front of that line) using sudo vi /private/etc/sshd_config, or using a sed command from Apple's Enabling X11 Forwarding. This will also ensure the DISPLAY variable is set automatically.

  • On your Linux machine:

    ssh -Y user@mac-box
    xterm
    

(Some next steps might then include Googling for Xephyr (or the older Xnest). And if you run into keyboard issues: Google xmodmap, or use xev for debugging. Or for font issues: Google xfs and xset +fp tcp/mac-box:7100. But I doubt you can run Aqua programs this way.)


It sounds like your main goal here is to view running Mac applications on a linux machine. Arjan is right, X forwarding won't work for this.

You should enable Screen Sharing in the Sharing pane in System Preferences. This will turn on a VNC server. Using a VNC client on your linux machine, you'll be able to see your Mac desktop. This article shows how to set it up on the mac side (steps 1-3), goes on (a bit too much) about setting up dyndns and opening ports in an Airport base station and then has a tiny bit at the bottom about setting up the client side (steps 20-21).