User Tools

Site Tools


programming:packaging_a_qt4_application_for_mac_os_x

Packaging a Qt4 Application for Mac OS X

The Mac OS X application is a so called bundle, which contains the binary, libraries, icons, etc. Here is the description, how to make a simple Mac package for a Qt application. You'll need Qt of course and dylibbundler. I keep my dylibbundler in the home directory (~/dylibbundler).

In the build directory invoke

APP=qaccord
mkdir -p $APP.app/Contents/{MacOS,libs}
cp qaccord/$APP $APP.app/Contents/MacOS
~/dylibbundler -od -b -x $APP.app/Contents/MacOS/$APP -d $APP.app/Contents/libs/

It is good to give the application an icon. An easy, however not automatic way of doing it is to open some icon image, copy it to clipboard using Apple+C. Then, find the build folder and right-click the application an select Get Info. (In fact it is a sort of hidden directory/folder.) By a single left-click, select the icon and using Apple+V paste the previously selected icon.

Setting icon in Mac OS X

Then, get back to the shell and invoke

macdeployqt -dmg $APP.app

After this, you can use the icon trick again and gvie the dmg an icon.

Note: To take a screenshot in Mac, press Apple+Shift+3 for the whole screen, or Apple+Shift+4 for selected area only.

programming/packaging_a_qt4_application_for_mac_os_x.txt · Last modified: 2017/05/16 11:10 (external edit)