1

I have created a Mac OS app. I am building the app on Ubuntu, and not able to make use of Xcode. When it comes to setting an icon for the app, I am at a loss. How can this be done?

This might appear as a duplicate to this question:

How do I set the icon for my application's Mac OS X app bundle?

However, the solution given here (to simply add the CFBundleIconFile tag in info.plist, with the associated .icns file in the app's Resources directory) does not work for me, nor does it appear to work for some others in that thread. The answer is quite old - is there a newer process? Or, must other steps be taken to get this to work? I am using a program called Image2icon to generate an .icns file - is it that this is not sufficient, and a different process must be taken to generate the .icns?

ffConundrums
  • 765
  • 9
  • 24

1 Answers1

1

Good evening, first question with answer, is that once the icon created and placed in the resource your current has not changed? (imagine that in the file info.plist you have named the icon) in this case you may have to delete 2 files to find the new icons below I leave you an applescriipt script that delete them 2 files that the system recreates automatically. in the script you have to change "yourname" and "yourpassword" by your username and password otherwise it will not work. once launched the script the screen will go black and reappear, I put xtrafinder, if you do not use it, erase the line with xtrafinder.

try

set erase to do shell script "sudo find /private -name" & quoted form of "com.apple.dock.iconcache" user name "yourname" password "yourpassword" with administrator privileges

do shell script "echo" & quoted form of erase do shell script "sudo rm -rf -v" & quoted form of erase user name "yourname" password "yourpassword" with administrator privileges

set erase to do shell script "echo" & quoted form of erase & " | sed 's

com.apple.dock.iconcache#com.apple.iconservices#'"

set erase to do shell script "echo" & quoted form of erase

do shell script "sudo rm -rf -v" & quoted form of erase user name "yourname" password "yourpassword" with administrator privileges

do shell script "sudo killall Dock" user name "yourname" password "yourpassword" with administrator privileges

do shell script "sudo killall iconservicesagent" user name "yourname" password "yourpassword" with administrator privileges

do shell script "Sudo killall Finder" user name "yourname" password "yourpassword" with administrator privileges quit application "XtraFinder"

do shell script "Sudo open -a /Applications/XtraFinder.app" user name "yourname" password "yourpassword" with administrator privileges

do shell script "sudo pkill loginwindow" user name "yourname" password "yourpassword" with administrator privileges

end try

Community
  • 1
  • 1
  • 1
    thank you for your post. Unfortunately I am developing everything in Ubuntu and can not make use of Apple scripts. I did find something out - for some reason, while I am on the mac, when I give 'touch /Applications/myapp.app' - this was sufficient to get the icon to change on the Dock! (so long as the CFBundleIconFile key is present in Info.plist). However, it still shows the default in Finder! This whole thing is beyond me! – ffConundrums Apr 29 '18 at 20:38
  • Please be curious, if you develop mac applications, it's for use on a mac no? Anyway, the info.plist contained in the applications, (professional or not), for the icons often refers to "icon file" and "key" an "icon.icns" file (icns files are multi dimentions (from 16x16 to 512x512 or 1024x1024) without using the CFBundleIconFile which have particular specifications according to Apple.For touch /Applications/myap very good idea, but here are iconservices and icon caches are always present and the Finder does not change the display. I proposed the script to have a global action with one click. – user9652975 Apr 30 '18 at 16:07
  • it's not about curiosity, it's about the constraints placed on me at my job place. Everything must be built on linux. But I do appreciate your suggestion. If I were able to do any of the development on mac, things would be easier, but this is not a possibility for me. – ffConundrums Apr 30 '18 at 18:33
  • It's me who is curious to know that you are on linux to make applications for mac. if i understand you are working on linux to sell mac apps. – user9652975 Apr 30 '18 at 21:07
  • oh I see. Yes that is the case :) The app being built is targeted for mac, however, there only machines available to build the app, are Linux based. Regardless, it's cool about your answer you posted, I was not even aware of apple scripts (I am new to mac), and at least I have something I can try to use locally for testing! So I thank you for your effort, and hoping others can benefit too – ffConundrums May 01 '18 at 00:25