Thanks to Karen Garner for bringing this problem to my attention, and thanks to Mike Lynn for showing the solution. I’m just expanding on the solution a bit using a specific example.
Sometimes, when you look in an app bundle on macOS, you see an .icns file in Contents/Resources, and you can use that or convert it to a .png.
For some apps, instead of an .icns file, you get an Assets.car file instead. There doesn’t appear to be an easy, native-to-macOS, point-and-click way to extract icons from the Assets.car file (even though some third-party utilities exist to do so). However, macOS does have some built-in command-line utilities that can help you get the icons out.
For this example, we’ll look at the System Settings app bundle. First, you can see in the Info.plist file what name the icon is using:
defaults read /System/Applications/System\ Settings.app/Contents/Info CFBundleIconName
That should display something like:
You can then see a bit more detail about what’s in the Assets.car file (including all the image and icon files associated with
assetutil -I /System/Applications/System\ Settings.app/Contents/Resources/Assets.car
If you want to get an .icns file, you can specify so:
iconutil -c icns /System/Applications/System\ Settings.app/Contents/Resources/Assets.car PrefApp -o ~/Desktop/System\ Settings.icns
If you want to get an iconset folder, you can specify that instead:
iconutil -c iconset /System/Applications/System\ Settings.app/Contents/Resources/Assets.car PrefApp -o ~/Desktop/System\ Settings.iconset