Important: Please read the Qt Code of Conduct -

How to set Qt Application EXE Icon in MAC OS ?

  • Hello All,

    I have developed Qt Application in MAC OS.I need to set Application EXE file icon.
    Here EXE means (.app) of MAC OS.

    I gone through with this link :

    Using above link i have done setting my Qt Application setup and .exe Icon in Windows version.
    But steps given in above link for MAC OS not working.

    Please suggest me where I am going wrong.



  • How are we supposed to know what you are doing wrong? You need to tell us what you have actually done. There are, for example 3 different sets of things to do in the OS X instructions you link. You need to do 2 of them.

  • I have followed Instruction of Setting the Application Icon on Mac OS X .

    First I have created myicon.icns and included "ICON = myicon.icns" to my application .pro file.But nothing happened.

    Second I also done the following manually:

    i. Create an Info.plist file .
    ii. Associated my .icns record with the CFBundleIconFile record in the Info.plist file.
    iii. Copy the .icns file into my application bundle's Contents/Resources directory.

    But again nothing changes.My application .app file building with default MAC OS app files Icon.

  • Have you tried to "clean" and then delete the APP bundle in the build directory? Eventually the info.plist is not updated and/or Finder is lazy on showing new icons for existing files.

  • to

    Yes I have cleaned and deleted whole build directory files many time and buildup again.

    I am building in release mode.Is it OK?

    There is following code writing in my .pro file.
    ICON = NetNewsWire256.icns

    QMAKE_INFO_PLIST = Info.plist
    OTHER_FILES += Info.plist
    And Info.plist code is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">





    Here is command using to packing my .app file


    and than creating .dmg using following command

    hdiutil create -format UDBZ -quiet -srcfolder myapplication.dmg

  • Using the qt 5.0.1 download this works for me. My .icns file is in a project subdirectory "icons". I think when I tried 5.0.0 it wasn't working.

    .pro file statement....

    ICON = $$PRO_FILE_PWD/icons/icon128.icns

  • I use
    @ICON = $$PWD/ICONNAME.icns@

    Where $$PWD is a reference to the file currently parsed = the .PRO file.
    The info.plist file is not referenced at all in my .PRO file. But there is
    @TEMPLATE = app@
    which should be there anyway IMHO.

    Are you sure that the s is missing in the info.plist file (NetNewsWire256.icn instead of NetNewsWire256.icns)?
    Is the icon file copied to the bundle (Resources directory inside the bundle)?
    When you ask if 'release' is ok, have you tried 'debug'? What's the result there?


    I have tried with ICON = $$PWD/ICONNAME.icns but same result no icon.Also same in debug mode.

    yes in Info.plist its NetNewsWire256.icns.

    I am not getting why qmake is not creating default Info.plist as I written in this link that if we are running qmake then only need to write only
    "ICON = NetNewsWire256.icns" in our .pro file and automatically
    Info.plist should be created in content directory and icon also automatically copied in content/Resource directory of app file.

    My Qt version is 4.8.1 . Is it make any difference?

  • Sorry, running out of ideas.

  • Now I have the same problem, it is caused by a "bug":

    Now I also use a custom info.plist file and do some of steps on my own:

    @# copy our info.plist template and replace variables, see qmake Variable Reference
    QMAKE_INFO_PLIST = $$PWD/osx/info.plist


    QMAKE_INFO_PLIST_OUT = $${TARGET}.app/Contents/Info.plist
    PRE_TARGETDEPS += $${TARGET}.app/Contents/Info.plist
    HC_ICONNAME = name_of_a_beautiful_icon.icns

    does not work, so maybe redundant

    ICON = $$PWD/Icons/$${HC_ICONNAME}

    write some extra info in the info.plist

    QMAKE_POST_LINK += /usr/libexec/PlistBuddy -c "Set :GIT_COMMIT_HASH $${HC_GITHASH}" $${OUT_PWD}/$${TARGET}.app/Contents/Info.plist

    SHORT_VERSION is replaced by the first 2 digits of the version number only. No TEMPLATE for full version available

    QMAKE_POST_LINK += ;/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $${VERSION}" $${OUT_PWD}/$${TARGET}.app/Contents/Info.plist

    if QMAKE_INFO_PLIST is assigned, the icon is not copied

    QMAKE_POST_LINK += ;cp -n $$PWD/Icons/$${HC_ICONNAME} $${OUT_PWD}/$${TARGET}.app/Contents/Resources/.@

    The QMAKE_POST_LINK looks a bit messy but additional build steps (that is the place where I believe it should be put) have no access to .PRO file variables. I'm going to replace that part with a single external bash script soon.

Log in to reply