ARCHIVED: In Emacs from a remote login, what is the "Can't open display" error?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

On some computers at Indiana University, Emacs expects you to be running the X Window System when you call it up, as you would be if you were logged in at the console of the workstation. If you are logged in remotely from another computer where you are not running X, Emacs will halt and report "Error: Can't open display".

Normally, Emacs automatically detects the appropriate mode of operation to use. However, when you log into some workstations, your DISPLAY environment variable, which tells X on what machine to display a graphical window for Emacs, may be automatically set. If you are not using a computer running X, you can unset this variable.

To unset the DISPLAY variable if your Unix shell is C-shell, or a C-shell variant (tcsh), at your shell prompt (by default a percent sign), enter:

  unsetenv DISPLAY

If your shell is Bourne shell or a Bourne shell variant (e.g., ksh or bash), at your shell prompt (by default a dollar sign), enter:

  unset DISPLAY

When you now run Emacs, you will be using terminal mode, and the program will work as expected.

If you would prefer to leave the DISPLAY environment variable set, but use Emacs only in terminal mode, the easiest method is to launch Emacs using the -nw option. To do this, at the shell prompt enter:

  emacs -nw

This is particularly useful in situations where your local computer is running X, but you prefer to use Emacs in terminal mode.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Related documents

This is document afmq in the Knowledge Base.
Last modified on 2018-01-18 10:05:24.