How to set icon on file or directory using CLI on OS X?
问题 To set an icon on a file or directory is straight forward using the "Get Info" dialog in Finder. copy image from e.g. Preview open "Get Info" on file or directory press TAB to select the icon paste Cmd-V But how do you do this using the command line? 回答1: Here is a bash script "setIcon.sh" for it #!/bin/sh # Sets an icon on file or directory # Usage setIcon.sh iconimage.jpg /path/to/[file|folder] iconSource=$1 iconDestination=$2 icon=/tmp/`basename $iconSource` rsrc=/tmp/icon.rsrc # Create