Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Installing Qt/Mac

You may need to be logged in as root, depending on the permissions of the directories where you choose to install Qt.

1. Unpack the archive if you have not done so already:

           cd /Developer
           gnutar xzf qt-mac-version.tar.gz

   This creates the directory /Developer/qt-version containing the files from the main archive.

   Rename qt-version to qt (or make a symlink):

           mv qt-version qt

   The rest of this file assumes that Qt is unpacked in `/Developer/qt`.

2. Set some environment variables in the file `.profile` (or `.login`, depending on your shell) in your home directory. Create the file if it is not there already.

   - QTDIR -- the directory in which you're building Qt
   - PATH -- to locate the moc program and other Qt tools
   - MANPATH -- to access the Qt man pages
   - LD_LIBRARY_PATH -- for the shared Qt library

   This is done like this:

   In `.profile` (if your shell is bash, ksh, zsh or sh), add the following lines:

           QTDIR=/Developer/qt
           PATH=$QTDIR/bin:$PATH
           MANPATH=$QTDIR/man:$MANPATH
           DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH

           export QTDIR PATH MANPATH DYLD_LIBRARY_PATH

   In `.login` (in case your shell is csh or tcsh), add the following lines:

           setenv QTDIR /Developer/qt
           setenv PATH $QTDIR/bin:$PATH
           setenv MANPATH $QTDIR/man:$MANPATH
           setenv DYLD_LIBRARY_PATH $QTDIR/lib:$DYLD_LIBRARY_PATH

   After you have done this, you will need to login again, or re-source the profile before continuing.

3. If you have the commercial edition of Qt, install your license file as `$HOME/.qt-license`.

4. Compile the Qt library, and build the example programs, the tutorial and the tools (e.g. Qt Designer) as follows.

   Type:

           cd $QTDIR
           ./configure

   This will configure the Qt library for your machine. Note that GIF support is turned off by default. Run `./configure -help` to get a list of configuration options.

   To create the library and compile all examples and the tutorial:

           make

   If you have problems, see http://www.trolltech.com/platforms/.

5. Once you have built Qt, it is ready to use. If Qt has not been configured with the -static option, then in order to be able to launch Qt applications from the Finder you must place the relevant libraries in a directory where they can be found. We recommend making these symbolic links (if you have configured Qt with -thread please change the libqt below with libqt-mt):

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

   You may need to have 'administrator' access to do this, (in which case, precede each command with `sudo'`, e.g. `sudo ln -s ...`). If you use sudo you'll be prompted for the administrator password.

   If you do not have administrator access, or you would prefer to do a user install (rather than system install) of the libraries you can do (if you have configured Qt with -thread please change the libqt below with libqt-mt):

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

That's all! Qt is now installed. Qt's documentation can be read with Qt Assistant or by any web browser; the contents page is `$QTDIR/doc/html/index.html`.