Deploy Folder with Icons (macOS)
Description
The following demonstrates how to successfully deploy folders with custom icons. There have been changes by Apple which means previous methods may fail to present the icon.
Information
This process will involve:
- Creating a fileset that includes the folders with icons
- Creating an Activation Script
- Change the properties of the script to include the paths to the folders
1. Create the Fileset
To build the fileset, the folder requires a custom icon. To add a custom icon, choose Get Info on the Folder (this could be an Application) and drag the icon or image file onto the folder icon at the top of the window:
Create a standard Fileset using this Folder or App.
2. Create An Activation Script
Highlight the Fileset and choose the Script icon.
In the Window that opens, select Activation Script and then choose to Create a script. In this example the script was called 'add-xattr.sh'
. The script should contain the following:
#!/bin/bash
{
for directory in "$@"
do
xattr -wvx com.apple.FinderInfo '00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' "$directory"
done
}
3. Change the Script Properties
Once created, highlight the script and choose 'Properties'
The Executable tab should be edited to match the path to the location of your Folder or Application containing the custom icon.
Associate the Fileset and on deployment the Folder or Application will have the chosen icon.
Multiple Folders with Icons
The Fileset can contain multiple folders with custom icons. For each folder containing a custom icon, add an additional Launch Argument in the Executable tab to match.