Remote login error: "DISPLAY is not set" How to set up X's to be able login on your iMac remotely and run graphical applications?

When I login I get this:

servername:~ loginname$ xterm
xterm: Xt error: Can't open display: 
xterm: DISPLAY is not set
servername:~ loginname$ echo $DISPLAY

servername:~ loginname$  launchctl list | grep xquartz 
-   0   org.macosforge.xquartz.X11.5840
5342    -   org.macosforge.xquartz.startx


P.S. I installed XQuartz 2.7.5 (xorg-server 1.14.4) and use it successfully from iMac itself for many mouths already.
I have OSX 10.9.4.
The solution appeared to be straight forward: just set

export DISPLAY=":0"


in .bashrc or whatever file your shell sources its profile from.