3 11 Building on MacOS
TellowKrinkle edited this page 2024-04-14 23:02:33 -05:00

General

Reminder: Don't forget to checkout submodules! git submodule update --init --recursive in the source directory if you're not sure whether you've done it or not.

Building on an Intel Mac

Build the dependencies using the CI's build script: .github/workflows/scripts/macos/build-dependencies.sh deps (this will build the dependencies into the directory deps). If you want to use a package manager, you can look at the install script to see the required dependencies. Note that we patch extra features into libshaderc, so you will need to compile that one yourself, as the package manager's version will not work.

You can set the environment variable BUILD_FFMPEG=0 to tell the dependency build script to build all the dependencies except ffmpeg, allowing you to use your homebrew or macports-installed ffmpeg, which probably has more features enabled than the build script's.

Building on an Intel Mac should work similarly to building on Linux. Run cmake with cmake /path/to/pcsx2/source -DCMAKE_PREFIX_PATH=/path/to/deps -DCMAKE_BUILD_TYPE=Release, then make. The final .app will be in pcsx2-qt/PCSX2.app in the build directory. (The CMAKE_PREFIX_PATH is only needed if you used the CI's build script to install dependencies.)

Add -DUSE_LINKED_FFMPEG=ON for video capture support.

Building on an arm (Apple Silicon) Mac

PCSX2 does not support building for arm. You will need to make Intel builds even on Apple Silicon and run them in Rosetta.

You will need Intel versions of all the dependencies. Dependencies from Homebrew will not work. The dependency build script will handle this for you (see Intel instructions). If you use MacPorts, install your packages with +universal. Note that we don't link to any libraries from qt6-qttools, so you can skip the universal on that one (and it links with libclang, so I'd recommend skipping it unless you really want to sit around while MacPorts builds a universal build of clang and llvm).

Add the following extra flags to the cmake invocation listed in the Intel Mac section:

  • -DCMAKE_OSX_ARCHITECTURES=x86_64. This tells cmake to do an Intel build even though you're on an arm Mac.

Building for development

The following extra cmake flags may be useful when building for working on PCSX2:

  • -DSKIP_POSTPROCESS_BUNDLE=ON. This disables a post-build step that fixes up all the dependencies and shoves them into the app bundle for easy distribution. Saves time on incremental builds.
  • -G Xcode. Tells cmake to generate an Xcode project instead of makefiles. Allows you to use Xcode to work on PCSX2.