Qt5.x Build Environment on MacOS Apple Silicon - magic-lantern-studio/mle-documentation GitHub Wiki

To get Qt 5.15.x working on your Apple Silicon Processor and, in addition, set up all required software to properly work together, use these QuickStart instructions.

[!NOTE] All of this information was derived from the excellent website How to set Qt 5.15 on Apple Silicon M1. Please reference this site for the original article.

Install Build Tools

Install Xcode

For native development for macOS, you need to have XCode. Install it from the App Store.

Also, you have to configure the command line tools using xcode-select:

sudo xcode-select --switch /Applications/Xcode.app

Install Homebrew

You can read about home-brew on the official site.

Homebrew installs the stuff you need that Apple (or your Linux system) doesn’t. Homebrew installs packages to their directory and then symlinks their files into /opt/homebrew (on Apple Silicon, which is precisely our case).

We’ll install several applications via brew later, so we must first install brew. Open Terminal and run this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The script explains what it will do and then pauses before it does it. Read about other installation options.

Install Official Qt

Use the official Qt installation because it has a handy Qt Maintainance Tool and can install/update/remove some Qt applications or libraries. In the future, you would like to install newer Qt versions or any other software via it. Also, it can install QtCreator — the IDE we will use for Qt development.

Download the official unified online installer.

Run it, provide your Qt credentials, and ensure the installer that you are not using Qt commercially. Select the components you’d like to install. The most important is Qt Creator 11.0.3. You may uncheck the rest; it's up to you: maybe you’d like to try Qt 6, so leave Qt 6.6.0 checked.

Install CMake

Install cmake via brew:

brew install cmake

Instal Ninja

Install ninja via brew:

brew install ninja

Install Qt 5.15.13

Install Qt via brew, too. According to its formulae, the subsequent macOS versions are supported:

  • Sonoma
  • Ventura
  • Monterey

Thanks to brew developers and supporters, they have already agreed to the Qt open-source license for us.

`brew install qt@5`

Configure Qt Creator

All required software components should now be installed. It's time to collect everything into the build Kit.

  1. Run QtCreator (typically, it is in your home folder -> Qt -> Qt Creator).
  2. Open Settings via Command +,
  3. Select the “CMake” tab. Manually add a new item with the name “CMake via brew” and following path /opt/homebrew/bin/cmake.
  4. Select the “Kits” tab.
  5. Open “Qt Versions”. Click the button “Link with Qt…”. Your Qt installation path should be: $HOMEBREW_PREFIX/opt/qt@5
  6. Hit “Apply” before jumping to the next page.
  7. Open the “Kits” tab.
  8. Manually add new kit. You may name it initially, like Qt 5.15.13
  9. For your newly created kit, you need to select C/C++ Compiler Apple Clang (arm64); Qt version — one that you’ve set previously; and CMake tool from the brew: “Cmake via brew”; CMake generator: “Ninja”.