Hi all, Have the following issue under Qt Creator Mac OS X 2.0.1 with SDK 4.7.1. Under the 'Projects' tab, for all of the configurations, there's a 'Build directory' field. I want the following directory structure under my home directory: /home /home/Dev. I don't think it has anything to do with reinstalling Qt. I am using the latest Qt 5.3 release. I think I read somewhere that when building Qt from source, you can specify the minimal deployment target for the Mac. This simply means that when the guys at Qt build the binaries, they specified Mac OS X 10.6 as the minimal deployment platform.
I prefer to build Qt from source. I have been trying to build Qt 4.8.5 on Mac OS X 10.9 (Mavericks). I managed in the end, but it took a few tweaks. Online information about how to do this was fragmentary, so I am documenting it here in case it is useful to someone else.
1. Webkit doesn’t build. I don’t need it so I disabled it using configure option:
- Download and install Qt Creator. Go to the Qt Creator official download site to download this software. Near the middle of the page, there is a gray bar of links; in that bar, click the link named 'Qt Offline Installers'. Now scroll down to 'OS X Host', and choose Qt 5.5.1 for Mac (588 MB). (The exact version may change over time, but make.
- If your Mac is using an earlier version of any Mac operating system, you should install the latest Apple software updates, which can include important security updates and updates for the apps that are installed by macOS, such as Safari, Books, Messages, Mail, Music, Calendar, and Photos.
- Therefore, make sure that the actual build system code reflects the minimum OS version that is actually required. The Mac Deployment Tool. The Mac deployment tool can be found in QTDIR/bin/macdeployqt. It is designed to automate the process of creating a deployable application bundle that contains the Qt libraries as private frameworks.
2. The corewlan plugin doesn’t build. I don’t need it (I think, I’ve never heard of it before) so I disabled it using this fix from stackoverflow.
3. The TIFF image format plugin doesn’t build. I don’t need it so I disabled it using configure option:
Mac Install Qt
My final configure command was:
./configure -nomake demos -nomake examples -debug-and-release -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-gif -no-openssl -no-webkit -no-libtiff
There will be lots of warnings that Qt 4.8.5 isn’t compatible with Mac OS X 10.9. But you can ignore these (or comment out the warning in the appropriate Qt header file).
I have done some brief experiments and it seems to work ok. Hopefully there will be a Qt 4.8.6 that fixes these issues. Note that you also need to make some tweaks to your application code. See:
** UPDATE April-2014 **
Qt 4.8.6 has been released. This appears to build fine on Mac OS X 10.9.
Qt Build For Mac Os 10.13
Downloading and Installing Qt
There are two ways to install Qt:
- through the Qt Installers - downloads and installs Qt
- through the Qt sources.
You can download the Qt 5 installers and sources from the Downloads page. For more information, visit the Getting Started with Qt page.
Building Qt 5 from Source
Below, you will find more information about building Qt from source.
- Qt for macOS - Building from Source - building and installing from source
Note: Qt 5 uses Cocoa, therefore, building for Carbon is not possible.
See Supported Platforms for the list of macOS versions supported by Qt.
Qt can be built for either x86 or x86_64. 64-bit is used by default. To select a 32-bit build, use the
macx-g++32 mkspec. This is selectable at configure time:
The Qt build system does not support building unversal binaries directly. Instead, use the
lipo tool to glue two Qt builds together.
Note: Qt 5 does not support OS X on PowerPC.
Note: Static builds are not tested.
Additional Command-Line Options
On the command-line, applications can be built using
qmake can generate project files for Xcode with
-spec macx-xcode. If you are using the binary package,
qmake generates Xcode projects by default; use
-spec macx-gcc to generate makefiles. For example:
-spec macx-xcode generates an Xcode project file from project.pro. With qmake you do not have to worry about rules for Qt's preprocessors (moc and uic) since qmake automatically handles them and ensures that everything necessary is linked into your application.
Qt does not entirely interact with the development environment (for example plugins to set a file to 'mocable' from within the Xcode user interface).
The result of the build process is an application bundle, which is a directory structure that contains the actual application executable. The application can be launched by double-clicking it in Finder, or by referring directly to its executable from the command line, for example,
If you wish to have a command-line tool that does not use the GUI for example,
ls, you can tell qmake to disable bundle creation from the
CONFIG variable in the project file:
Deploying Applications on macOS
In general, Qt supports building on one macOS version and deploying to earlier or later macOS versions. The recommended way is to build on the latest version and deploy to an earlier macOS version.
macOS applications are typically deployed as self-contained application bundles. The application bundle contains the application executable as well as dependencies such as the Qt libraries, plugins, translations and other resources you may need. Third party libraries like Qt are normally not installed system-wide; each application provides its own copy.
Qt Designer Mac
A common way to distribute applications is to provide a compressed disk image (.dmg file) that the user can mount in Finder. The deployment tool,
macdeployqt (available from the macOS installers), can be used to create the self-contained bundles, and optionally also create a .dmg archive. Applications can also be distributed through the Mac App Store. Qt 5 aims to stay within the app store sandbox rules. macdeployqt (bin/macdeployqt) can be used as a starting point for app store deployment.
The page below covers specific issues and recommendations for creating macOS applications.
Where to Go from Here
We invite you to explore the rest of Qt. We prepared overviews to help you decide which APIs to use and our examples demonstrate how to use our API.
- Qt Overviews - list of topics about application development
- Examples and Tutorials - code samples and tutorials
- Qt Reference Pages - a listing of C++ and QML APIs
Qt's vibrant and active community site, http://qt.io houses a wiki, a forum, and additional learning guides and presentations.