X11 on macOS

X11 can be accessed using XQuartz as available via Homebrew.

brew install libx11 xquartz

To finish the one-time setup of XQuartz, logout/login or reboot. Check that X11 server is available by

echo $DISPLAY

which should show a temporary directory ending like “org.xquartz:0”.

Demo and troubleshooting

See that X11 is working with the classic Xeyes test GUI.

xeyes

A useful image browsing program on Linux, macOS etc. is feh:

brew install feh

Troubleshooting: XQuartz GitHub Issues

Specifically, be sure XQuartz is enabled in Login Items to fix problems like the XQuartz window won’t open.

XQuartz will open automatically when any X11 program is started.


Related: PulseAudio on macOS