'Get Qt5 up and running on a new Mac
Coming from Ubuntu I bought a new iMac and tried to setup my Qt development. Everything else is already up and running. Xcode command line tools are also installed.
Because it surprised me how good brew
and brew cask
worked I wanted to install Qt5
with them. On the one side it is very fast and I do not have to got to any homepage in order to download it. On the other side I do not have to care about the installation directory. Having multiple version installed should also be a lot simpler though.
I used the following commands:
brew install qt5
brew cask install qt-creator
Qt5
is now installed under /usr/local/Cellar/qt5/5.4.1
. I also added the bin
folder to my path (done in .bash_profile
). QtCreator, Linguist and all the other applications are shown in my launchpad. But unfortunately, it is still not done.
QtCreator
says that no version of Qt is known. I tried to add qmake but I was not able to navigate to the folder mentioned above.
Could anybody give me a hint on how to fix this issue? Installing qt via installer should be the last option.
Solution 1:[1]
I had similar issue with Qt Creator, now on Mac GUI applications do not have access to environmental variables (in previous versions it was different).
You need to setup path to qmake in Qt Creator manually using Command-Shift-G in Finder to navigate to Folder you need.
Solution 2:[2]
Another option is to use brew link qt5 --force
, which will symlink the various Qt5
binaries and libraries into your /usr/local/bin
and /usr/local/lib
directories. This will give you qmake
at the command line, without requiring you to add anything special to your path in .bash_profile
. The main reason this isn't done by default is that Qt4
is also somewhat popular.
It could get a little messy, but if you need to install Qt4
as well, you can unlink Qt5
at any time, by doing brew unlink qt5
, and it will keep the installation intact. Then do brew install qt
to get Qt4
, which unlike the brew installation for Qt5
will indeed create the links directly into /usr/local
without you having to manually do brew link qt
. You can unlink Qt4
and relink Qt5
(or vice-versa) whenever you need to switch.
Solution 3:[3]
In my cases I needed to set it in Preferences => QT Versions => Add. Environment variables also did not help. Small popup when starting app also did not work.
Solution 4:[4]
I use command like this:
brew install qt@5
and. success install qt5 by brew.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | demonplus |
Solution 2 | nonrectangular |
Solution 3 | Evalds Urtans |
Solution 4 | Doongbin |