Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 brewand brew caskworked I wanted to install Qt5with 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.

like image 712
Nick Lehmann Avatar asked Apr 03 '15 12:04

Nick Lehmann


People also ask

Where is Qt5 installed Mac?

Qt5 is now installed under /usr/local/Cellar/qt5/5.4.

Can you use Qt on a Mac?

For this example we'll install Qt 5.7. 1, which is supported on macOS version 10.8 and later. The C++ compiler used by Qt on macOS is the Clang compiler, provided as part of the Xcode development tool. You will need to install Xcode from the Apple App Store.


2 Answers

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.

like image 103
demonplus Avatar answered Sep 21 '22 13:09

demonplus


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.

like image 33
nonrectangular Avatar answered Sep 21 '22 13:09

nonrectangular