Adding a Homebrew-installed Qt to Qt Creator on a Mac
Asked Answered
G

3

6

I installed Qt5 and Qt Creator via homebrew. Since they were installed independently of each other, Qt wasn't automatically added to the list of known Qt installations in Qt Creator. I thought adding an installation would be simple, but...

Since homebrew installs all casks under /usr/local/, which is a hidden directory, I can't navigate to the desired Qt installation using the folder navigation dialog opened by Qt Creator, when Kits > Qt versions > add is pressed in the options. I have used the terminal to make hidden folders and files visible in the "normal" Finder, but they don't show up in Qt Creator.

How do I add a Qt installation located in a hidden folder to Qt Creator?

Gasometry answered 8/12, 2018 at 13:57 Comment(1)
#15714182Jorge
P
5

It's weird but even if I can see hidden files and folders on my Mac, usr folder don't appear in the search window of Qt when I want to add a new Qt version.

To reach it out you can use ⌘⇧G yes, and, if your Qt version is 5.12.1 the full path to copy paste would be something like that:

/usr/local/Cellar/qt/5.12.1/bin/qmake

Or you can create a shortcut for usr folder if you want, control click on the usr folder and click on "Create an alias" that would be visible in the search window of Qt, or in the terminal use ln -s to create a symlink in the folder where you want to find the symlink.

ln -s /usr/

or

ln -s /usr/local/Cellar/qt/5.12.1/bin/

Then it's easy to select the qmake file to add a new Qt version to Qt-creator.

After that if you have a problem with GCC and G++, to make it work properly you need to select Clang in the kit settings.

Protuberance answered 15/3, 2019 at 8:56 Comment(2)
Note newer versions of homebrew have their Cellar in /opt/homebrew/CellarFootman
@Footman I think that's in Linux, right? Unless brand new installations of homebrew use /opt/homebrew/Cellar as well... while 'old' installations with 'new' versions of homebrew continue to use /usr/local/Cellar.Kev
J
1

"On Mac, /usr is hidden by default, but you can access the path directly — press ⌘⇧G and type /usr into the popup."

Jorge answered 11/2, 2019 at 4:5 Comment(0)
Z
0

As-of https://github.com/Homebrew/homebrew-core/pull/124923 being merged today: you can add Homebrew's Qt to QtCreator's "Qt Versions" in:

Preferences > Qt Versions > Link with Qt...

pressing "Choose..." and selecting as the Qt installation path the location of your $(brew --prefix) i.e. /opt/homebrew on Apple Silicon or /usr/local on Intel. As mentioned elsewhere (thanks!), you may find ⌘⇧G helpful in selecting the full path here.

Zachary answered 10/3, 2023 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.