Setting up X11 and OpenGL on your laptop/desktop


X11 is the graphics display protocol used by UNIX systems. If you're logging into one of the Nevis systems with your own computer (laptop or desktop) using a plain-text Terminal program, you will almost certainly need X11 to run applications such as ROOT.

If you try to run a program and you don't see the graphics display you expected, or you get messages of the form Can't open display, then it probably means that you did not forward your X11 connection as described in the following steps. To check this, on the remote system examine the value of the variable $DISPLAY:

     echo $DISPLAY
If $DISPLAY has a value (typically of the form localhost:NN:N) then the X11 connection has been forwarded correctly. If $DISPLAY is blank, then something has gone wrong with one of the steps (did you remember to capitalize -XY?).

Note that X11 spews forth error messages constantly. If the program is working and you see the graphics you expect, ignore these messages. In particular, this message is common and does not indicate that anything is wrong:

libGL error: failed to load driver: swrast

Setting up X11 on Mac OS

For Mac OS 10.7 and later, you're going to need to install XQuartz.

Note: You rarely have to deliberately start up XQuartz. If an application uses X11, XQuartz will detect it and automatically start itself.

You'll want to enable X11 forwarding. There are two ways to do this:

  • When you use ssh to connect to a Nevis system, use the -X -Y options (or just -XY). You must use capital-X and capital-Y (lowercase x and y turn X11 forwarding off). For example:
     ssh -XY

  • If you don't want to type -XY every single time you login to a Nevis system, you can change your ssh options so that -XY are automatically activated. To do this, in Mac OS edit the file ~/.ssh/config and add the following lines (strictly speaking, only the first line is necessary):
     ForwardX11 yes
     ForwardX11Trusted yes
     ForwardAgent yes

Setting up X11 on Linux

It's already there. Note that you can set up X11 forwarding the same way as described for Mac OS.

Note: X11 might not be there if you set up your laptop with a minimal text-only Linux installation without graphics. If you have that level of expertise, I'll assume you know how to install X11 if you need it.

Setting up X11 on Microsoft Windows

You will need both an ssh emulator and an X11 emulator. I suggest mobaXterm, which provides both and is free. Be sure to check out the documentation; I don't know anything about the program except what I read on that page.

If you've installed Windows Subsystem for Linux (WSL), you'll still need an external X11 server program such as mobaXterm to connect to a remote server and run X11 programs. Since forwarding an X11 connection from a server program through WSL to a remote server requires a bit of setup, I strongly recommend that you simply use mobaXterm (or another X-server program if you prefer) and skip WSL for this purpose. If you really want to set this up, here 's one example of a procedure, though that page recommends using Vcxsrc instead of mobaXterm.

After you've downloaded and installed mobaXterm, you will want to turn on X11 forwarding. This post has details about how to do this. Note that "host" refers to the name of a server at Nevis and "username" is your Nevis account name; e.g., a command like

ssh -XY
implies that in mobaXterm you'd put for the hostname and jsmith for the username.


You probably don't need to enable OpenGL at all. In case you do (your collaboration will let you know), there's how.

Some X11 applications use OpenGL; in physics, a notable example is Geant4 . The idea behind OpenGL is that it can use the graphics hardware on your computer to render graphics; sometimes this works. If you run an X11 program and you get a lot of error messages about graphics and/or blank regions in your windows, you can see if the program requires OpenGL.

OpenGL on Linux

It's probably sufficient to install the glx-utils package on Linux if it's not already installed. You can test if that package is already installed using the glxinfo command. If you get any output other than "glxinfo not found" then you have the package.

If glx-utils is not installed, the commands to do this are:

  • In Debian/Ubuntu flavors of Linux:
     sudo apt-get install glx-utils

  • In Redhat flavors:
     sudo yum install glx-utils

You may also need to install the drivers for your particular graphics card. Consult the web site of the manufacturer and look for instructions on how to install Linux drivers.

OpenGL on Mac OS

OpenGL is not enabled in XQuartz by default. You'll have to do the following one-time configuration:

  • Find out which version of XQuartz you're using. Within XQuartz, go to the XQuartz menu and select About X11.

  • Quit XQuartz.

  • If you are running XQuartz 2.8 or later, open the Terminal app (in Applications->Utilities) and copy-and-paste the following command:
     defaults write org.xquartz.X11 enable_iglx -bool true

  • If you are running XQuartz 2.7.x or earlier (which might be the case if you installed it some time ago), open the Terminal app (in Applications->Utilities) and copy-and-paste the following command:
     defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

OpenGL on Microsoft Windows

mobaXterm contains an OpenGL renderer; there should be no additional steps needed.

In the Settings->X11 tab, you'll see a setting that allows you to choose between OpenGL rendering: hardware, software, or none. "Hardware" will only work if you have the appropriate OpenGL drivers installed for your graphics card. Probably "software" or "none" should work as-is.

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2023-06-01 - WilliamSeligman
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback