Installing Qt/Mac

Table of contents:

Installing Qt Mac

The Mac OS X installation is done from a terminal. To launch a terminal, look in Applications/Utilities with Finder.

If your system does not have a C++ compiler installed, you must install one yourself before installing Qt. An easy option is to install GCC from Apple's Developer Tools CD.

  1. Unpack the archive file from the CD:

    cd /Developer
    tar zxf /Volumes/Qt 3 Programming/mac/qt-mac-free-3.2.1.tar.gz

    The archive is unpacked into /Developer/qt-mac-free-3.2.1.

  2. Create a symlink from this directory to /Developer/qt:

    ln -sf qt-mac-free-3.2.1 qt
  3. Set up certain environment variables for Qt.

    The variables are set differently depending on which shell you are using. For example, if your user name is kelly, you can find out which shell you are using with the finger command:

    finger kelly

    If your shell is bash, ksh, zsh, or sh, add the following lines to the .profile file in your home directory:


    If your shell is csh or tcsh, add the following lines to your .login file:

    setenv QTDIR /Developer/qt
    setenv PATH $QTDIR/bin:$PATH
    setenv MANPATH $QTDIR/doc/man:$MANPATH

    If you encounter "undefined variable" problems, change the last two lines above to these:

    setenv MANPATH $QTDIR/doc/man

    After you have done this, the settings must be activated. The easiest way to do this is to close the terminal window and then open a new terminal window.

  4. Execute the configure tool in the new terminal with your preferred options to build the Qt library and the tools supplied with it:

    cd $QTDIR

    You can run ./configure -help to get a list of configuration options. For example, you can use the -thread option to create a threaded version of the library.

  5. Type make.
  6. Make your applications launchable from Finder.

    If you built Qt using the -static option, your executables will contain the Qt library and can be run from Finder automatically. Otherwise, your executables will need to use the Qt library on your system. This is achieved by creating two symlinks:

    ln -sf $QTDIR/lib/libqt.3.dylib /usr/lib
    ln -sf $QTDIR/lib/libqui.1.dylib /usr/lib

    If you built a multithreaded version of Qt, replace libqt.3.dylib with libqt-mt.3.dylib in the first ln command above.

    Creating these links may require administrator access; if this is the case, run the commands preceded by sudo:

    sudo ln -sf $QTDIR/lib/libqt.3.dylib /usr/lib
    sudo ln -sf $QTDIR/lib/libqui.1.dylib /usr/lib

    If you don't have administrator access or just want to install Qt locally, use these links instead:

    ln -sf $QTDIR/lib/libqt.3.dylib $HOME/lib
    ln -sf $QTDIR/lib/libqui.1.dylib $HOME/lib

    As mentioned above, if you built a multithreaded version of Qt, replace libqt.3.dylib with libqt-mt.3.dylib.

If you want to customize how you install Qt or if you encounter problems with installing Qt, refer to the INSTALL file in $QTDIR for more information.

Part I: Basic Qt

Getting Started

Creating Dialogs

Creating Main Windows

Implementing Application Functionality

Creating Custom Widgets

Part II: Intermediate Qt

Layout Management

Event Processing

2D and 3D Graphics

Drag and Drop


Container Classes





Providing Online Help


Platform-Specific Features

C++ GUI Programming with Qt 3
C++ GUI Programming with Qt 3
ISBN: 0131240722
EAN: 2147483647
Year: 2006
Pages: 140 © 2008-2020.
If you may any questions please contact us: