Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Qt on MacOS X Sierra and add qmake on terminal

Tags:

c++

macos

qt

I want to install Qt on my Mac and use the qmake through terminal to compile code. I downloaded the open source Qt Creator from Qt site, but I cannot set it up. Anyone with similar problems?
System: Mac OS X Sierra, Qt version: 5.7. I'm downloading the open source installer from qt.io/download-open-source . I'm installing it to Users/MyUserAccount and i want set it up so i can compile C++ code with qmake && make

like image 594
georgekom Avatar asked Oct 06 '16 20:10

georgekom


People also ask

Where is QMake on Mac?

Qmake is at /usr/local/opt/qt/bin .

Does Qt run on macOS?

Instead, macOS uses its own native windowing system that is accessible through the Cocoa API. To download and install Qt for macOS, follow the instructions on the Getting Started with Qt page. To build Qt from source, see Qt for macOS - Building from Source.


2 Answers

Just to provide another solution using Homebrew.

As you've found QT4 isn't compatible with Mac OSX Sierra.

You can install QT5 using:

brew install qt5

But you'll find you can't access qmake from the command line. To rectify this you'll need to run:

brew link qt5 --force
like image 162
elMarquis Avatar answered Oct 06 '22 19:10

elMarquis


If you want to run qmake from command line, add the directory where qmake is located to PATH environment variable. How to do it depends on the shell you are using, for bash it is done by adding export PATH=$PATH:<path_to_qmake> to either ~/.profile, ~/.bash_profile or ~/.bashrc.

like image 1
Paul Avatar answered Oct 06 '22 17:10

Paul