Last active
December 8, 2020 01:08
-
-
Save dtschust/a1a82b599c0d3a454db68c40b085f01f to your computer and use it in GitHub Desktop.
Change mac app icon programatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# I believe you need XCode installed to get sips/Rez/SetFile | |
# Have an Icon.png in the current working directory | |
# Resize it to 512 by 512 for some reason | |
sips -z 512 512 Icon.png --out myIconResized.png | |
# make it an .icns file | |
sips -s format icns myIconResized.png --out myIcon.icns | |
# do something else…? | |
echo "read 'icns' (-16455) \"myIcon.icns\";" >> tmpicns.rsrc | |
# add it to the app | |
rm $'/Applications/Slack.app/Icon\r' | |
Rez -append tmpicns.rsrc -o $'/Applications/Slack.app/Icon\r' | |
# enable the icon | |
SetFile -a C /Applications/Slack.app/ | |
# restart slack | |
killall Slack | |
# Now manually reopen the application, doing it via command line doesn't update the UI for some reason. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment