Thursday, February 19, 2009

Display X windows on X11.app from another linux box

Sometimes you might want to ssh to a linux box and be able to fire up X applications and see the X windows on your Mac running X11. However, there are some customizations you need to do before everything works.

  1. Fire up X11.app (It's located in /Applications/Utilities/X11.app)
  2. On Mac box: go to X11 preferences and enable "Allow connections from network clients" (Make sure it looks like below)
  3. Restart X11.app
  4. Open a terminal in X11 and do: xhost +
  5. ssh to your linux box and do: export DISPLAY=IP_OF_MAC_BOX:0.0




Bingo! On the linux box, you can now run any X app, say xterm and the X window will pop up on your Mac box.

5 comments:

TP said...
This comment has been removed by the author.
TP said...

Thank you so much. This thing was driving me crazy, it was your tip to restart X11 that did the trick.

(only now I realize that the settings dialog explicitly say that a restart is required. Shame on me).

Thanks a lot.

Ørjan said...

Won't "ssh -X" do the same thing, and you won't need to use xhost? xhost is not very secure. Much better to tunnel things through ssh.

Marcelo said...

Hi!
And what about all the way around?
Can i access my Mac using X11 forwarding from another Mac (or even from a linux machine)?
I'm trying to do this for a while but always unsuccessful

Cheers

Anonymous said...

Great this is what i wanted..works great.

thanks a lot..