Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't figure out what is setting my $DISPLAY variable to 0

Hi there,


I've recently encountered problems with starting up MATLAB on OSX 10.6.8.

I've figured out from Mathwork's support, that it's because my $DISPLAY variable is, for some reason unknown to me, set to 0.


I have no idea which application or script is changing my $DISPLAY variable.

Is there any way for me to trace what causes this on my computer, or to disable the script/application to set the varible on start up?


I'm right in the middle of writting my thesis and am highly dependent on MATLAB, so I need to solve this problem ASAP.


Thank you for your help!

MacBook Pro, Mac OS X (10.6.8)

Posted on Feb 15, 2012 9:10 AM

Reply
7 replies

Feb 15, 2012 9:58 AM in response to tunglutti

Look in /tmp for an entry that looks like the following


/tmp/launch-RvQ93B/org.x:0


This should be assigned as your DISPLAY environment variable automatically as you login to the Mac OS X GUI.


For example my DISPLAY environment variable looks like


echo $DISPLAY
/tmp/launch-RvQ93B/org.x:0


If you are remotely connecting to another system and exporting your X11 display back to your Mac, then you should be using something like:


ssh -Y username@remote.system.address
-OR-
ssh -X username@remote.system.address


which will automatically export your DISPLAY variable to the remote system and setup an ssh tunnel for transporting the X11 window back to your Mac.


NOTE: You should never personally set your DISPLAY environment variable on your Mac nor on your remote system as part of your shell initialization scripts (.bash_profile, .bash_login, .bashrc, .profile, .cshrc, .tcshrc, .kshrc, .zshrc, etc...)


Message was edited by: BobHarris

Feb 15, 2012 1:03 PM in response to etresoft

In Snow Leopard and Lion, X11 is suppose to be started on demand when someone access the DISPLAY value. The /tmp/launch-0cxGPr/org.x:0 is a Named Socket which launchd is listening to:


lsof /tmp/launch-EcQ2yO/org.x:0
COMMAND PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
launchd 125 raharris   12u  unix 0xffffff80154aafa0      0t0      /tmp/launch-EcQ2yO/org.x:0


If this does not exist, then that would say something is not right on the OP's system.


The OP could always try an lsof search


lsof | grep org.x:0
launchd     125 raharris   12u    unix 0xffffff80154aafa0       0t0         /tmp/launch-EcQ2yO/org.x

Can't figure out what is setting my $DISPLAY variable to 0

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.