Building Qt on Mac OS X

From BATCOM-IT Services Wiki
Jump to: navigation, search

Creating a Qt programming environment on Mac OS X

Requirements

Download the latest Qt source code:

Building Qt

Extract this tar-ball to a directory where you are going to build it (note this Qt bug which may still be valid, Qt 4.8.6 test pending), then configure and build it completely:

 $ mkdir -p ~/src && cd ~/src
 $ gzcat /tmp/qt-everywhere-opensource-src-4.8.7.tar.gz | tar xfv -
 $ cd qt-everywhere-opensource-src-4.8.7
 $ ./configure -fast -opensource -confirm-license -release
 ...
 ...
 ...
 $ make -j5
 ...
 ...
 ...

For Qt 5, omit the -fast option on the configure command line as the option no longer exists.

Installation

Install the library (it will be installed to /usr/local/Trolltech/Qt-4.8.6)

$ sudo make install

and make sure that /usr/local/Trolltech/Qt-4.8.7/bin is part of the $PATH environment variable. Add it before all system-defined default binary paths to avoid calling any left-overs from an old Qt installation, like in this example:

$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/Trolltech/Qt-4.8.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin

See also

Mac OS X specific official installation instructions: