Deploy Qt applications for Mac OS X

This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply be to disable some style sheet settings that I didn’t need.

After this I wanted to create a nice .dmg file for easy deployment on Mac OS X. Thankfully, this process is not hard either. I found this through the Qt Documentation, but it is actually simpler than it seems thanks to the macdeployqt tool. This is mentioned on the page, but I decided to give a more thorough walk through on how to use the tool here:

  1. Build your application
  2. In the build directory, run
    macdeployqt yourappname.app -dmg

    macdeployqt is found in the ~/Library/QtSDK/Desktop/Qt/474/gcc/bin folder (if that is where you installed Qt)

  3. You should now have a nice yourappname.dmg file in the build directory. Open this up and check that your application runs from there.
  4. If everything is working fine, you can do some prettifying of your .dmg file by opening it up using the Disk Utility and converting it to a Read/Write disk image.
  5. Open your Read/Write disk image and create a shortcut to your Applications folder. This could either be done by dragging the Applications folder while holding the command key or by creating a symbolic link in terminal:
    ln -s /Applications ./Applications
  6. Edit the icon size, background image, etc. by clicking Command + J to open the View Options. Also, use View -> Hide Toolbar and Hide Sidebar to hide the excessive toolbars from the disk image.
  7. Close the image and use Disk Utility to convert it back to a compressed disk image.
  8. Distribute your .dmg file.

If you need more details about the process and how deployment is performed, have a look in the Qt Docs.

Published by

Svenn-Arne Dragly

I'm a physicist and programmer, writing about the stuff I figure out as I go.

11 thoughts on “Deploy Qt applications for Mac OS X”

  1. Which version of QT were you deploying with?

    I’m having trouble with macdeployqt on QT 5.0.0 Beta. Application seems to open up fine, but nothing gets displayed ….

      1. work for me when I have running in my build directory were my app is was build with path to macdeployqt

        afterpartys-MacBook-Pro:build-Atlas-Desktop_Qt_5_4_0_clang_64bit-Release afterparty$ /Users/afterparty/Qt5.4/5.4/clang_64/bin/macdeployqt atlas.app

  2. First thing thanks a lot for this post.

    using macdeployqt i have added qt libraries to my app,
    but I need to add some third party libraries also in it.

    Can you give me some suggestion that how to add in my app content.

Leave a Reply