Bochs with XQuartz on macOS

Installing Bochs on macOS is relatively straight forward with homebrew:

$ brew cask install xquartz
$ brew install homebrew/x11/bochs

When trying to run it, I got the following error though

Event type: PANIC
Device: [GUI   ]
Message: Cannot connect to X display

This happens because either XQuartz is not running or Bochs does not know how to communicate with it. You’ll need to do two things:

  1. Start XQuartz.app
    • This will open an xterm terminal. Don’t close it
  2. Now you have two options:
    • Run Bochs from within xterm
    • Run echo $DISPLAY inside xterm and copy the result. Then run export DISPLAY="<copied string>" in your normal terminal
  3. Either way, Bochs will now know which X display to connect to

Feedback is always welcome and I try to incorporate it into the post where possible. For reasons of Datensparsamkeit I do not provide a commenting solution here, however. You can reach me via email (see home page) or Twitter.