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.
  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

(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.)

  • 1
    Unfortunately you are right. I can't run Xcode and iPhone simulator via SSH, even though I can run xterm. Also, I did not need to install XQuartz on stock 10.6 install. – Alex B Oct 5 '09 at 15:34
  • @AlexB Did anything change in the last 10 years? – Muhammad bin Yusrat Apr 14 '20 at 7:59

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).

  • And there's also many programs out there that only share a single application (rather than the whole desktop). I think one can even do that using the latest Skype, cross-platform. (I am not sure if Skype also allows one to control the remote machine, rather than only peeking to its screen.) – Arjan Oct 3 '09 at 13:03
  • I wish I could avoid using it. It seems VNC remains the only alternative at this point. – Alex B Oct 5 '09 at 15:36

Just use

su -lm <usrname-to-proxy-for>

to enter into a shell where no X11 issues will occur. See manpages for details about the '-m' option.

  • -m Leave the environment unmodified. The invoked shell is your login shell, and no directory changes are made. — how is that related to the question? – Arjan Jun 17 '12 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.