One of the things i’ve been dealing with a lot is icons, and icon files and how to actually generate the damn things. It’s not really clearly documented, at least anywhere that I could find.
Normally if you were writing an Xcode application there’s a utility there that takes a pre-prepared graphic file and does all the processing to make it into the .icns file you require for that app. But what if that’s overkill? There are other things that can use .icns files and firing up Xcode, or even installing nearly 4Gb of Xcode is a little overkill for a one time use.
So I spent a little time this morning and wrote this: Create ICNS .
This is just a bash script that uses existing tools already provided on macOS to do the processing for you. If you’re interested, look up “sips” and “iconutil”.
To start, prepare your icon file. There are some hard rules on this.
- It must be 1024×1024 resolution
- It must have a DPI of 144. No more, no less.
- It must be in .png format
Download the script to your computer. Run it from terminal like this:
./createicns.sh <full path to file>
It will then process your original file and turn it into a proper .icns of the same name for you. It’ll even warn you if any of the requirements aren’t correct. Bish bash bosh, all done!