Installing Qt/qmake via brew

I can’t get brew to correctly install qmake on macOS. I’ve tried to install the qt and qt5 formulae and the qt-creator cask, plus I ran brew link qt5 --force as suggested by this link, but none of these things worked.

The qt formula is keg-only, so you need to use full paths to access its stuff. Qmake is at /usr/local/opt/qt/bin.

Since it’s keg-only for a reason (specified in the Caveats section), avoid linking it unless you’re ready to face the consequences.

$ brew install qt
<...>
==> Caveats
<...>

qt is keg-only, which means it was not symlinked into /usr/local,
because Qt 5 has CMake issues when linked.

If you need to have qt first in your PATH run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc

For compilers to find qt you may need to set:
  export LDFLAGS="-L/usr/local/opt/qt/lib"
  export CPPFLAGS="-I/usr/local/opt/qt/include"

For pkg-config to find qt you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"
$ ls /usr/local/opt/qt/bin
balsam			lupdate			qdbus			qmake			qmlplugindump		qtattributionsscanner	repc
canbusutil		lupdate-pro		qdbuscpp2xml		qmlcachegen		qmlpreview		qtdiag			syncqt.pl
fixqt4headers.pl	macchangeqt		qdbusxml2cpp		qmleasing		qmlprofiler		qtpaths			tracegen
lconvert		macdeployqt		qdistancefieldgenerator	qmlformat		qmlscene		qtplugininfo		uic
lprodump		meshdebug		qgltf			qmlimportscanner	qmltestrunner		qvkgen			xmlpatterns
lrelease		moc			qhelpgenerator		qmllint			qmltyperegistrar	qwebengine_convert_dict	xmlpatternsvalidator
lrelease-pro		qcollectiongenerator	qlalr			qmlmin			qscxmlc			rcc

Running that, followed by source ~/.zshrc, fixed my problem.

Thanks!

1 Like
Imprint