tags:

views:

363

answers:

2

According to this, for best results in Leopard my $DISPLAY variable should start with /tmp/launchd. Alas, my $DISPLAY variable is /tmp/launch-aLhnOW/:0

I do not set $DISPLAY in any of these ...

  • /private/etc/profile
  • /private/etc/bashrc
  • ~/.bash_profile
  • ~/.profile

... so I suspect there is some other configuration file that X11 is reading. Any suggestions?

I specifically need to ensure that it is not set anywhere. Per the linked article:

Starting X11.app from the dock will get you two icons, setting it to auto-launch is also a no-no, and if you have set DISPLAY in any of your configuration files you get a disaster.

+1  A: 

You should be able to set it in the ~/.MacOSX/environment.plist file. Details can be found here.

Fabian Steeg
Thanks for the suggestion. As it turns out, I do not have a ~/.MacOSX/environment.plist, so that is not where $DISPLAY is being set.
Thomas L Holaday
You should not set DISPLAY statically in Leopard or Snow Leopard. Launchd is responsible for setting it for you, and if you set it manually in something like environment.plist you will break things.
n8gray
+3  A: 

I think your DISPLAY variable looks all right. I don't think it is being set by a configuration file.

Normally you have a launchd configuration file such as /System/Library/LaunchAgents/org.x.startx.plist. This contains a section:

    <key>Sockets</key>
            <dict>
                    <key>:0</key>
                            <dict>
                                    <key>SecureSocketWithKey</key>
                                            <string>DISPLAY</string>
                            </dict>
            </dict>

I believe this causes launchd to open a socket and set the DISPLAY variable to its path. When a program contacts this socket, startx is invoked by launchd.

Bruno De Fraine
This is correct. The `/tmp/launchd` on that page is a typo. That article is also very old and out of date. The X server on OS X has been improving at a rapid pace. See http://xquartz.macosforge.org for the most current information.
n8gray