How to set Qt 5.15 on Apple Silicon M1

Nazar
4 min readOct 10, 2023

If you landed on this page, you’ve already researched how to get Qt 5.15 working on your Apple Silicon M1 (M2 or maybe already M3?) processor. Setting up Qt 5.15 on a MacBook with an Apple Silicon processor can be slightly different than on Intel-based Macs due to the ARM architecture. Keep in mind that Qt 6 works out of the box.

M1 is Apple’s first chip designed specifically for the Mac and its most powerful chip ever created. Image source

In this article, we’ll try to get Qt 5.15.10 working on your Apple Silicon Processor and, in addition, set up all required software to properly work together in the way I prefer it to be. I’d like to have control over installed software and be able to set build Kits as explicitly as possible. This requirement was inspired by recommendations from P.Hintjens from his book “Confession of a Necromancer” (you can read it for free):

Pieter Hintjens avatar. Image source

Lesson learned: identify the riskiest parts of your architecture and bring them under your full control.

The main lessons I learned were obvious and yet worth stating, perhaps because the industrial world is so distant from the normal pure digital development world:
— Don’t expect random work from random vendors to magically work together.
— Do not develop and test in your production environment.
— When things go wrong that even marginally involve you, assume responsibility until you know where the real problem lies.
— You can work significantly faster when you use hardware and software that bends to your will.

That's handy advice! We’ll try to build a kit that will bend to our will.

Great book and a great author. Unfortunately, most developers' friends ignore my recommendation to read such a great book. But will you?

Installing required software

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

Homebrew

You can read about it on the official site, but I’ll say what it is.

  • 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.

Official Qt installation

I suggest having an 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.

CMake

As Wiki says:

In software development, CMake is cross-platform free and open-source software for build automation, testing, packaging, and installation of software by using a compiler-independent method. CMake is not a build system; it generates another system’s files.

It’s effortless to install via brew:

brew install cmake 

Ninja

Ninja is a small build system with a focus on speed. It differs from other build systems in two significant respects: it is designed to have its input files generated by a higher-level build system to run builds as fast as possible.

Let’s install it via brew:

brew install ninja

Qt 5.15.10

As you may suspect, we’ll 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. If this is unacceptable, you should proceed with the next step.

`brew install qt@5`

Setup Qt Creator

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

  • Run QtCreator (typically, it is in your home folder -> Qt -> Qt Creator).
  • Open Settings via Command +,
  • Select the “CMake” tab. Manually add a new item with the name “CMake via brew” and following path /opt/homebrew/bin/cmake
  • Select the “Kits” tab.
  • Open “Qt Versions”. Click the button “Link with Qt…”. Your Qt installation path should be: $HOMEBREW_PREFIX/opt/qt@5
  • Hit “Apply” before jumping to the next page.
  • Open the “Kits” tab.
  • Manually add new kit. You may name it initially, like Qt 5.15.10 Superb!
  • 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”.
That’s how the newly created Kit looks

Congratulations! Now you can use your kit to create beautiful applications! Test it via File -> New Project -> Qt Widget Application, and select your Superb kit for it!

Superb kit as a default kit for new project

Wish you successful build and only easy to catch bugs!

--

--

Nazar

Qt/C++/Python/QML developer, OpenSource enthusiast. Like experiments with sound creation/music and calligraphy. Fond of computer & board games. Proud Ukrainian.