Can't add icon to Application

Mac OSX specific forum
Andrew Lindsay
User
User
Posts: 24
Joined: Mon May 30, 2011 12:17 pm

Can't add icon to Application

Post by Andrew Lindsay »

How do I add an Icon to an App in Mac OS-X?

I've created the .icns file, but not having any luck getting things to work.
Andrew Lindsay
-----------------------------------------
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: Can't add icon to Application

Post by Wolfram »

You must save the Icon in to the App Contens/Resources/ folder.
Than you must add/edit these line of the Info.plist file.

Code: Select all

<key>CFBundleIconFile</key>
<string>myIcon.icns</string>
macOS Catalina 10.15.7
Andrew Lindsay
User
User
Posts: 24
Joined: Mon May 30, 2011 12:17 pm

Re: Can't add icon to Application

Post by Andrew Lindsay »

Where do I add the resource file? Why can't I just add the path to the file in the COMPILE OPTIONS form where it has a checkbox and link to the icon file?

Regards

Andrew
Andrew Lindsay
-----------------------------------------
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Can't add icon to Application

Post by wilbert »

Andrew Lindsay wrote:Why can't I just add the path to the file in the COMPILE OPTIONS form where it has a checkbox and link to the icon file?
You can. It should work fine and is the easiest way.
The PB manual does mention that you might need to restart Finder when the application is just created for it to show the right icon.
So restarting Finder might help or maybe something is wrong with your .icns file.
Windows (x64)
Raspberry Pi OS (Arm64)
Andrew Lindsay
User
User
Posts: 24
Joined: Mon May 30, 2011 12:17 pm

Re: Can't add icon to Application

Post by Andrew Lindsay »

Hmm,

Not having any success with that.

Here is my project directory zipped up.

https://login.filesanywhere.com/fs/v.as ... 676d769d9f
Andrew Lindsay
-----------------------------------------
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Can't add icon to Application

Post by Kukulkan »

Hello,

the key is the Info.plist file inside of your .app file (folder Contents/). The values inside are XML and here you can find all values and their meaning:

https://developer.apple.com/library/con ... -TPXREF110

Please note that this is for both iOS and MacOS. It is always mentioned if it is only for one of the two platforms.

In general, for a program icon, you set the value of CFBundleIconFile to the filename of your icon. The icns file itself must be located in Contents/Resources path inside of your .app. You can easily create .icns icon file from PNG using the free tool "Image2Icon" from iTunes app store.

I suggest to take a look into existing .app files (Applications -> right click -> Show Package Contents). You may also Google for some Info.plist example to get some more help.

<update>Your ZIP looks good, but I'm not sure about the "&" character in filename and XML. I personally would avoid any special characters in any file or path names. If there is an issue with that, it is really hard to track and find...</update>

Best,

Kukulkan
tester
User
User
Posts: 30
Joined: Sun Dec 28, 2014 1:12 pm

Re: Can't add icon to Application

Post by tester »

Andrew Lindsay wrote:Hmm,

Not having any success with that.

Here is my project directory zipped up.

https://login.filesanywhere.com/fs/v.as ... 676d769d9f
Just change the name of the Output Executable in Compiler Options and everything will be fine.
e.g. Factor&Root.app -> Factor_Root.app
Post Reply