Thanks, this is extremely helpful. First, my overrides.plist. I am indeed uid 501, and:

wlan-clients-1816:com.apple.launchd.peruser.501 griznog$ pwd
/var/db/launchd.db/com.apple.launchd.peruser.501
wlan-clients-1816:com.apple.launchd.peruser.501 griznog$ ls -al
total 4
drwx------  3 griznog wheel  102 Nov 12 11:37 .
drwxr-xr-x 15 root    wheel  510 Oct  5 19:09 ..
-rw-------  1 griznog wheel 2200 Nov 12 10:59 overrides.plist

The XQuartz sections there appear ok to me:

<key>org.macosforge.xquartz.privileged_startx</key>
<dict>
<key>Disabled</key>
<false/>
</dict>
<key>org.macosforge.xquartz.startx</key>
<dict>
<key>Disabled</key>
<false/>
</dict>

I enabled debugging and lo and behold:

11/12/12 11:44:59.427 AM launchctl[313]: launchctl: Dubious permissions on file (skipping): /Library/LaunchAgents

Turns out the entire /Library was owned by my user account. I have to assume this was self-inflicted, although nowhere in the history for root or me can I find a chown that would have done this. In addition, while file permissions on files were correct, the /Library/LaunchAgents directory had managed to become group writeable. 

Thanks for your help. This also fixed a google drive problem and citrix receiver problem which I hadn't noticed until they started working correctly once this was addressed.

Thanks,

griznog



On Mon, Nov 12, 2012 at 11:27 AM, Jeremy Huddleston Sequoia <jeremyhu@apple.com> wrote:
That's odd.  I wonder if you've got some permissions mucked up.  Take a look at your overrides.plist:
/var/db/launchd.db/com.apple.launchd.peruser.<your uid>/overrides.plist

The default user is uid 501, so that would be /var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

Does it have org.macosforge.xquartz.startx disabled?  Is it writable by your user?  What is logged to syslog when you load the plist with -w (ie, what's in /var/log/system.log)?

If you want to debug laucnhd, you can create this file:
/private/var/db/.launchd_log_debug on Mountain Lion or /var/db/.debug_launchd on Lion

Its existence will trigger launchd to start in debug mode.  This will have detrimental impact on your system's performance, so make sure you remove that file when you're done debugging...

--Jeremy

On Nov 12, 2012, at 10:06 AM, John Hanks <john.hanks@usu.edu> wrote:

> I've tried this several times, but repeating and verifying was worth a try:
>
> wlan-clients-1816:~ griznog$ launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
> wlan-clients-1816:~ griznog$ launchctl list | grep quartz
> -     0       org.macosforge.xquartz.startx
> wlan-clients-1816:~ griznog$
>
> [log off and back on]
>
> wlan-clients-1816:~ griznog$ launchctl list | grep quartz
> wlan-clients-1816:~ griznog$ echo $DISPLAY
>
> wlan-clients-1816:~ griznog$
>
> So this smells like a problem with launchd/launchctl, but I can't find any hooks that allow me to figure out where and as I mentioned before, the .plist files for XQuartz are identical (as far as I can tell) on both the broken and working systems.
>
> If this request follows the path of others I've googled up like it, this is the point after which I get no more responses :/
>
> griznog
>
>
> On Mon, Nov 12, 2012 at 10:55 AM, Jeremy Huddleston Sequoia <jeremyhu@apple.com> wrote:
> Use 'launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist' to load the agent (and have it loaded later, that's what -w does).
>
> Logout and log back in, and you should have $DISPLAY
>
> You should be able to run 'launchctl getenv DISPLAY' to verify that launchd is providing $DISPLAY.  It's possible that something else (startup script) is unsetting it.
>
>
> On Nov 12, 2012, at 8: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
> >
> > _______________________________________________
> > Xquartz-dev mailing list
> > Xquartz-dev@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo/xquartz-dev
>
>
> _______________________________________________
> Xquartz-dev mailing list
> Xquartz-dev@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/xquartz-dev
>
>
> _______________________________________________
> Xquartz-dev mailing list
> Xquartz-dev@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/xquartz-dev


_______________________________________________
Xquartz-dev mailing list
Xquartz-dev@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/xquartz-dev