What should my $DISPLAY variable be and why is it not set?

I am using Max OSX 10.10.2 Yosemite and SSHing into a remote machine but cannot get X11 forwarding to work. When I ssh -X RemoteMachine, I get :

$echo "$DISPLAY"

to return nothing. Indeed, when I am logged in to my local MacBook and echo $DISPLAY, I also get nothing. When, however, I log in to OtherMachine via NX and echo $DISPLAY it gives me :1001. Then, when I ssh -X RemoteMachine (from OtherMachine), I am able to echo $DISPLAY and get a return value of localhost:12.0 - so I suspect the reason that I cannot get a $DISPLAY from my mac is that I don't have a $DISPLAY set on my mac.

So ... why don't I have a $DISPLAY environment variable set on my mac and how should I go about setting it so that I can correctly get X11 forwarding?


Solution 1:

To get X you need to install XQuartz

If you already have XQuartz you need to ssh to your remote machine from an XQuartz xterm.