X Window System

Sources:

X Window System

X11 Forwarding

X11 forwarding lets you run graphical applications on a remote Unix/Linux server and display them locally.

Client Setup (Local Machine)

  1. Install an X server:
    • Windows: Xming or VcXsrv
    • macOS: XQuartz
    • Linux: Usually pre-installed
  2. Run the X server On macOS, start XQuartz. The window isn't used directly—just leave it running.
  3. Connect with SSH: Use -X or -Y options:
    • -X: Safer, but more restrictive
    • -Y: Less restricted, for trusted connections

Example ssh command:

1
ssh -X username@remotehost

Server Setup (Remote Host)

  1. Install X11 applications Make sure graphical tools like xclock, xeyes, or others are available.

  2. Configure SSH Edit /etc/ssh/sshd_config:

    1
    2
    X11Forwarding yes
    X11DisplayOffset 10

    Restart SSH service:

    1
    sudo systemctl restart sshd

Testing

  1. SSH into the server using -X or -Y

  2. Run a GUI app, e.g.:

    1
    xclock

If correctly set up, the app window will show on your local machine.

DISPLAY Variable

X11 uses the DISPLAY environment variable to route graphical output.

  • On local desktops: :0 (the main screen)
  • With SSH forwarding: something like localhost:10.0, where SSH tunnels the display through TCP (e.g., port 6010)

Historically, many X terminals connected to a central server in this way.

macOS Caveats

XQuartz is the only X server on macOS, but it does not fully support OpenGL via X11 forwarding. GLX-based applications like glxgears may show static windows or fail entirely.

Workaround:

1
2
3
# On your host machine
export LIBGL_ALWAYS_INDIRECT=1
glxgears

This forces software rendering, but animations may freeze because XQuartz lacks proper GLX indirect rendering support.

If you need OpenGL or full graphics rendering remotely on macOS, use VNC or xpra instead of XQuartz.