ARCHIVED: Why does my X Window System application fail with the message "Cannot open display"?

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.

When using a X Window System application in Unix, the following are several possible reasons you may receive the message "Cannot open display":

  • The DISPLAY environment variable is not set to a valid X host. Normally, to use an X client, you must have the DISPLAY variable set to host:0, where host is the name or IP address of the X workstation or terminal which you are using for display. Make sure that it is set to a valid display. For example, if you are using /bin/csh on a workstation named joe, you need to execute the command setenv DISPLAY joe:0.
  • The host is not currently running an X Window System session. You need to start X Windows on the host.
  • The host may not be granting access to the remote machine (from which you are executing the X application). For example, if you are connecting to the host from Quarry at Indiana University, you will need to issue the command xhost quarry to allow access to applications starting from Quarry. UITS does not recommend that you allow access by executing the xhost + command by itself, since this makes the X display accessible to the entire Internet, and may allow unauthorized access to your computer.

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

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