Installing Qt/Mac
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.
- 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.
- Create a symlink from this directory to /Developer/qt:
ln -sf qt-mac-free-3.2.1 qt
- 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:
QTDIR=/Developer/qt PATH=$QTDIR/bin:$PATH MANPATH=$QTDIR/doc/man:$MANPATH DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH export QTDIR PATH MANPATH DYLD_LIBRARY_PATH
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 setenv DYLD_LIBRARY_PATH $QTDIR/lib:$DYLD_LIBRARY_PATH
If you encounter "undefined variable" problems, change the last two lines above to these:
setenv MANPATH $QTDIR/doc/man setenv DYLD_LIBRARY_PATH $QTDIR/lib
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.
- 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 ./configure
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.
- Type make.
- 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.