How do I run a GUI app via SSH?
I'm used to working on Unix/Linux and recently moved to Mac. In used to be able to do this:
derick@linux1:~$ ssh -X linux2
derick@linux2's password:
derick@linux2:~$ xclock
I've install X11 from maxports and I can do the same from my mac. If I try the reverse by ssh-ing into my mac from linux I can only run certain apps:
-
/usr/X11/bin/xclock
works fine -
Something like
/Applications/Preview.app/Contents/MacOS/Preview
opens the GUI on the mac.It seems that this is not possible on a mac? If not, how do I run an application remotely (on a mac) with a local (linux) display? Do I need some third-party app?
Update: To be more precise: I have synergy and use Mac for coding. On my linux PC I would like to see another application's display (GUI) from Mac. Thus, 'live screen sharing' apps like VNC will not work.
For example I'm working on my mac in app A (say Word) and want to see the output of Excel (running on mac) on my linux PC next to me. (Simulating a dual screen via the network). It worked nicely on linux, hoping for a solution for mac.
Solution 1:
So if I am not mistaken the the problem you have with VNC currently is that it is sharing the current Mac user's screen with apps open that you don't want to see on your other computer? Lion introduces the ability to screen share users that are logged in the background. Quoting the text from the link:
- Enable Screen Sharing and set a VNC password.
- Take note of your computer’s IP address.
- Fire up a VNC client on another machine.
- Connect to your computer’s IP address along with the password you set earlier.
- You will see the Mac OS X login screen that appears when you first start the computer. If you log into the currently active user you will be controlling the computer’s screen. If you select a different user, you will be logged into that user’s desktop in the background. It will not affect what what is seen on the physical computer screen.
You will likely just need to create another user for sharing.
Solution 2:
The Mac OS X native application do not use the X protocol for the rendering, but the Mac specific protocol. So you cannot use ssh X protocol forwarding as you could with a Linux workstation.
As you discovered, the reverse is not true, you can install an X server on Mac OS X and have the Linux program appear on your Mac.
What you can do is use either Mac own desktop sharing facility or install a VNC server. Then from your Linux box, you connect to your Mac through VNC instead of ssh.