If you connecting to a server and have an error like
"Can't open display", you may need to set up the environment correctly,
and fix your computer to display X windows.
You need to have some sort of X-window manager running on your local
machine. It comes built-in for Linux/Unix distributions. For OS X,
you have to run the "xterm" (under Utilities).
For example, the program "xv"
opens a graphical window on your machine. Your machine has to be set up
to display the windows it receives.
If you get the error message "xv: Can't open display", then
your machine is not able to open up the windows. (Another possibility is
that the server does not know where to open the windows.
It may assume that you are in my office by default.)
Here's what I do to get it to work on my machine at home:
Once xv is running, click with the right-most button to see the controls,
including load, save, and quit. I just did all of the above, and got xv
to work from home. Here is what I typed:
- I start X11, which is a standard window manager. Open a Finder window,
and look under Applications /
Utilities. You may need to download a window manager if your machine
does not have one.
- I type :
in the xterm window (a terminal window that opened up when I started X11).
This command tells my computer that I want my.server.address.name to be able
to display windows on it.
- I type:
ssh -Y -l myaccountname my.server.address.name
in the same xterm window. The "-Y" option allows for secure windows. Use
"-X" instead if "-Y" does not work (some older versions of ssh support -X
but not -Y). The -X or -Y says that you want graphic windows to be opened
up on your home/remote machine.
After this command, enter the password.
- I type:
this is a command being run on the remote server.
It is not necessary, but gives me
information about where the server will send the graphic windows. I get
"server:10.0" as a response today; I just typed it. If this command produces
a blank line, then something above was not done correctly.
- I type:
and the window pops up on my machine at home. This can be slow, depending
on your connection. If it's dial-up, be very patient.
myHomeMac:~> xhost +my.server.address.name
my.server.address.name being added to access control list
myHomeMac:~> ssh -Y -l myaccount my.server.address.name
Last login: Sat Oct 1 17:38:41 2005 from myDSLconnexion
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
bash-2.05$ echo $DISPLAY
Connection to my.server.address.name closed.
The prompt of "myHomeMac" is my home computer - any command typed at that
prompt will be executed on it. The "bash-2.05" prompt is from server. Any
command that I type there will be executed on that server.
The same sequence of commands is used for viewing LaTeX's graphical
output, except of course instead of "xv" it would be "xdvi".