Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to do something that's a little odd. I'm SSH'ing from a server to a Snow Leopard client to start an X11 data display process. In other words, SSH's X11 forwarding isn't what I want.

I can do:

client$ echo $DISPLAY
client$ ls -l $DISPLAY
srwx------  1 myuser  wheel  0 Dec  9 15:47 /tmp/launch-SOMETHING/org.x:0

And, when I do:

server$ ssh myuser@client
client$ export DISPLAY=/tmp/launch-SOMETHING/org.x:0
client$ xterm

I happily get my xterm.

What I need, then, is some way to find out the correct value for $DISPLAY in my ssh session. From what I've read, $DISPLAY is set by launchd, but I haven't found any way to see that value.

If it matters, I know that when my process connects from $server to $client, $client will logged in to the terminal as the same user.

share|improve this question
up vote 0 down vote accepted

I'm not sure if this is the best answer (gonna wait a few days to flag it!) but seems promising:

First, make a script on $client, say,

echo $DISPLAY > /path/to/saved_disp

Next, make a LaunchAgent .plist for it, save it in ~/Library/LaunchAgents. Have it start with an interval of 60 seconds or something.

Finally, load it in the Aqua session:

launchctl load -S Aqua ~/Library/LaunchAgents/my.display.saver.plist

If you just load it normally, $DISPLAY won't be set and your file will be empty.


server$ ssh myuser@client
client$ export DISPLAY=`cat /path/to/saved_disp`
client$ xterm

and success.

Seems to keep working across reboots. I'm pretty happy with it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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