Some more information, on teh *broken* system,  the X11 log contains:

X11.app: main(): argc=2
argv[0] = /Applications/Utilities/XQuartz.app/Contents/MacOS/X11.bin
argv[1] = -psn_0_110619
Waiting for startup parameters via Mach IPC.
X11.app: No launchd socket handed off, unsetting DISPLAY
X11.app: do_start_x11_server(): argc=6
argv[0] = /opt/X11/bin/Xquartz
argv[1] = :0
argv[2] = -nolisten
argv[3] = tcp
argv[4] = -auth
argv[5] = /Users/griznog/.serverauth.524
[4115098.637] Xquartz starting:
[4115098.637] X.Org X Server 1.13.0
[4115098.637] Build Date: 20120927


On the *working* system, the X11 log contains:

X11.app: main(): argc=2
argv[0] = /Applications/Utilities/XQuartz.app/Contents/MacOS/X11.bin
argv[1] = --listenonly
Waiting for startup parameters via Mach IPC.
X11.app: Listening on socket for fd handoff:  (6) /var/tmp/tmp.0.yu6h0g
X11.app: Thread created for handoff.  Returning success to tell caller to connect and push the fd.
X11.app Handing off fd to server thread via DarwinListenOnOpenFD(8)
DarwinListenOnOpenFD: 8
X11.app: do_start_x11_server(): argc=6
argv[0] = /opt/X11/bin/Xquartz
argv[1] = :0
argv[2] = -nolisten
argv[3] = tcp
argv[4] = -auth
argv[5] = /Users/griznog/.serverauth.72224
[2923013.589] Xquartz starting:
[2923013.589] X.Org X Server 1.13.0
[2923013.589] Build Date: 20120927

Thanks,

griznog




On Mon, Nov 12, 2012 at 9:25 AM, John Hanks <john.hanks@usu.edu> wrote:
Hi,

I have two systems running Mountain Lion, on one (iMac) XQuartz works fine and as expected. On the other (Macbook Pro) the DISPLAY environment variable never gets set. After troubleshooting this off and on for a month or more, I'm here to beg for some help or insight. What I've tried:

 - Reinstalling and/or upgrading XQuartz numerous times
 - using launchctl to load the LaunchAgent and/or LaunchDaemon with and without -w.

I can start XQuartz manually and it works fine, e.g. I can display a terminal from it and then ssh to another host and remote display an X app. But, the OS X terminal doesn't have DISPLAY set and thus I can't ssh to hosts with working XForwarding or start X apps locally from the OS X Terminal.

After comparing the two systems, I can't find any obvious difference between the files or permissions in the install. 

On the broken system, I can "launchctl load ..." the LaunchAgent and LaunchDaemon plist files, but if I log out and log back in they are no longer loaded. They get loaded automatically on the working system and set DISPLAY appropriately. 

I've tried using a $HOME/.launchd.conf file to load these, but it gets ignored. When I add them to /etc/launchd.conf the system never completes booting. I tried this approach out of desperation, note that the working system has neither of these files present. 

If someone can point out to me what I might be doing wrong here I'd greatly appreciate it.

Thanks,

griznog