X11 guide

Some applications on Linux servers require an X11 server to display graphical output from command-line-instantiated programs like Firefox or Mathematica. You'll need to install and configure an X11 server on your PC or Mac, be connected to a wired network or the VPN, and then set up the DISPLAY variable on the Linux host for PC. 

X11 setup for Windows:

First, check that the DISPLAY variable is set - some servers will prepopulate that variable. You can make sure it's set correctly by typing 'echo $DISPLAY' and you should see your current machine's IP address followed by :0.0
display variable

If you need to set the DISPLAY variable so that it uses the current IP address that you are connecting, copy and paste this line into your terminal window right after you log in. This only needs to be done once: 

echo "export DISPLAY=\$(echo \$SSH_CONNECTION|awk '{print \$1 \":0.0\"}')" >> ~/.bashrc
echo 'export XAUTHORITY=$HOME/.Xauthority' >> ~/.bashrc 

You can make sure it's set correctly by typing 'echo $DISPLAY' 

Installing an X11 server and using your connection:

  1. Install VcXsrv: https://sourceforge.net/projects/vcxsrv/ 

  2. Select 'Multiple Windows' and set the 'Display Number' to 0 and click Next: 

X11 options
  1. Select 'Start No Client and click Next: 

X11 options 2
  1. When you get to Extra Settings and check the 'disable access control' option: 

X11 options 3
  1. Click the Save configuration button and save as a config file. When you want to use X11 forwarding, double click that configuration file in the future. 

  2. When prompted, allow both firewall exceptions for public and private networks, otherwise X11 forwarding won't work. 

  3. Use Terminal to connect to your ssh server using the -Y switch - 'ssh -Y USERNAME@SERVERNAME.genetics.wisc.edu' : 

Powershell X11 example
  1. The DISPLAY variable should be set to your current IP address that you are connecting from. 
    You can make sure it's set correctly by typing 'echo $DISPLAY' 

Display variable
  1. Test it out using 'xeyes' to make sure it works: 

Xeyes googly

X11 on Mac:

X11 on Macs also require an X11 server, in this case XQuartz. 

  1. Download and install the latest version of XQuartz: https://www.xquartz.org/
  2. After XQuartz is installed, open XQuartz and then launch the xterm application from the Applications menu at the top.
  3. Connect to your server via ssh using the '-Y' option - for instance: "ssh -Y nairland@compute01.genetics.wisc.edu" .
  4. Set the Xauthority variable - this only needs to be done once:
    echo 'export XAUTHORITY=$HOME/.Xauthority' >> ~/.bashrc 
  5. Check your DISPLAY variable by typing "echo $DISPLAY" - you should see something like 'localhost:11.0" for XQuartz.
  6. Check that X11 is working by running 'xeyes' like above.


Keywords:
genetics, X11, windows, linux, linux servers, Mac 
Doc ID:
154201
Owned by:
Heidi S. in College of Agricultural & Life Sciences
Created:
2025-08-14
Updated:
2025-08-27
Sites:
College of Agricultural & Life Sciences