Getting QMake to generate a proper .app

Tags: qmake qt xcode
By : mkrus

I have a large exiting C++ project involving:

  • 4 applications
  • 50+ libraries
  • 20+ third party libraries

The project uses QMake (part of Trolltech's Qt) to build the production version on Linux, but I've been playing around at building it on MacOS.

I can build in on MacOS using QMake just fine but I'm having trouble producing the final .app. It needs collecting all the third party frameworks and dynamic libraries, all the project's dynamic libraries and making sure the application finds them.

I've read online about using install_name_tool but was wondering if there's a process to automate it.

(Maybe the answer is to use XCode, see related question, but it would have issues with building uic and moc)


By : mkrus


I'm sure this could be of some great help for you :


Hope this helps !

By : Jérôme

I side-stepped this problem completely by building my Qt app statically on OS X. That might not be practical for you though.

We have the same problem at, I looked at DeployQt and it's not much use if you have third party libraries. In the end I wrote a perl script that generates a Makefile, which you can use to generate a .app and/or .dmg.

I uploaded it here:

To use it add this to your application's pro file:

 macx*:!macx-xcode:release {
     system( QT=\'$$QT\' QMAKE_LIBDIR_QT=\'$$QMAKE_LIBDIR_QT\' $$ROOT_DIR/common/dist/mac/ $$DESTDIR $$VERSION $$LIBS > Makefile.dmg )
     QMAKE_EXTRA_INCLUDES += Makefile.dmg   

I'm sure it's not all yet portable, but it would be good for someone else to use and see if that is so.

This is basically the first official release of this code, so please send me bug reports, and also, improvements. Thanks.

By : mxcl

This video can help you solving your question :)
By: admin