Spin up a VM. In this case, I used a CentOS 6.4 image. Change your password and install SSH keys so you can shell in without a password. Probably want to disable root login too, on any system you plan to keep around for more than a few minutes. Log in as a regular user and sudo su to root.
Install X11 and some clients, and the xauth package to do the magical auth stuff. You probably don’t need the whole X server, but it gets all the dependencies on there, and I’m too lazy this late evening to try it without. This Worked For Me™.
[[email protected] ~]# yum install xorg-x11-server-Xorg
[[email protected] ~]# yum install xterm
[[email protected] ~]# yum install xorg-x11-xauth
Start X11 on the Mac, and go into Preferences. Under the Security tab, check the box next to “Allow connections from network clients”:
SSH into your cloud VM, using the -X switch. You can also use the -v switch to see what’s going on. The verbose debuggery that is around the X forwarding negotiation should look like this (preceding output removed for brevity):
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Wed Sep 18 05:41:08 2013 from 18.104.22.168
[[email protected] ~]#
Start xterm to see if it works!
[[email protected] ~]# xterm
If it works, in a few moments an X window will pop up on your Mac: