Building cen64 on macOS

Published January 11, 2020

For testing Nintendo 64 homebrew ROMs, cen64 is the most accurate emulator (though it doesn’t run at full speed yet). Here’s how to build it from source on macOS:

  1. Install XQuartz from the official distributed disk image
  2. git clone
  3. cd cen64
  4. mkdir build
  5. cd build
  6. cmake ..
  7. make

If you’d like to enable cen64’s debug logging, create a debug build when running cmake:

cmake -DCMAKE_BUILD_TYPE=Debug ..

When running cen64 outside of an XQuartz X11 terminal, it may report:

create_device: Failed to initialize the VI.
Failed to create a device.

To fix this, you can run it within an XQuartz X11 terminal, or simply set the DISPLAY environment variable to something like :0 either in your .bashrc file or inline during invocation:

DISPLAY=:0 ./cen64 /path/to/pifdata.bin /path/to/rom.z64

DISPLAY needs to be set because cen64 calls XOpenDisplay with a NULL display name (presumably to default to your DISPLAY environment variable), but if it’s not set, XOpenDisplay returns NULL and cen64 has no display within which to create a window for rendering Nintendo 64 content.

For extremely verbose register-level output, edit CMakeLists.txt and set DEBUG_MMIO_REGISTER_ACCESS to ON. Make sure to remove any cached data in build/ to ensure your changes are reflected, then recompile and re-run.