Skip to content

Instantly share code, notes, and snippets.

@Le0xFF
Last active April 29, 2023 16:08
Show Gist options
  • Save Le0xFF/512230b055fbca173536d1d7175df6b9 to your computer and use it in GitHub Desktop.
Save Le0xFF/512230b055fbca173536d1d7175df6b9 to your computer and use it in GitHub Desktop.
Simpler script to convert .PNG to .ICNS in macOS
# SOURCE
# https://stackoverflow.com/questions/12306223/how-to-manually-create-icns-files-using-iconutil/20703594#20703594
# BETTER VERSIONS
# https://github.com/retifrav/generate-iconset
# https://gist.github.com/djhaskin987/110e324f0bda182b6db34241da0182a6
# https://gist.github.com/djhaskin987/110e324f0bda182b6db34241da0182a6
# https://gist.github.com/yoannmoinet/051d92d132218dc3ad801f74f6f1536c
# USAGE
# Put this file and the .PNG image (1024x1024 px) in the same folder, rename it to Icon1024.png and from terminal run:
# source SimplerConvertToICNS.src
mkdir MyIcon.iconset
sips -z 16 16 Icon1024.png --out MyIcon.iconset/icon_16x16.png
sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_16x16@2x.png
sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_32x32.png
sips -z 64 64 Icon1024.png --out MyIcon.iconset/icon_32x32@2x.png
sips -z 128 128 Icon1024.png --out MyIcon.iconset/icon_128x128.png
sips -z 256 256 Icon1024.png --out MyIcon.iconset/icon_128x128@2x.png
sips -z 256 256 Icon1024.png --out MyIcon.iconset/icon_256x256.png
sips -z 512 512 Icon1024.png --out MyIcon.iconset/icon_256x256@2x.png
sips -z 512 512 Icon1024.png --out MyIcon.iconset/icon_512x512.png
cp Icon1024.png MyIcon.iconset/icon_512x512@2x.png
iconutil -c icns MyIcon.iconset
rm -R MyIcon.iconset
# After that:
# - Boot into Recovery
# - Open Terminal
# -- csrutil authenticated-root disable
# - Reboot into Recovery
# - Open Terminal
# -- mount -uw /Volumes/macOS/
# -- mount -uw /Volumes/macOS\ - \ Dati/ /Volumes/macOS/System/Volumes/Data/
# -- mount -t apfs /dev/disk6s2 (Preboot) /Volumes/macOS/System/Volumes/Preboot
# -- cd /Volumes/macOS/
# -- rm -rf .VolumeIcon.icns System/Volumes/Data/.VolumeIcon.icns System/Volumes/Preboot/.VolumeIcon.icns
# -- cp /Volumes/macOS/Users/leot/Downloads/ICNS/Ventura.icns System/Volumes/Data/.VolumeIcon.icns
# -- cp /Volumes/macOS/Users/leot/Downloads/ICNS/Ventura.icns System/Volumes/Preboot/.VolumeIcon.icns
# -- ln -s System/Volumes/Data/.VolumeIcon.icns .VolumeIcon.icns
# -- csrutil authenticated-root enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment