How to find the location of an icon file on OS X?

I couldn't find that exact icon because I wasn't able to produce such a certificate file. If you can tell me where to find such a file, I might have better luck.

I was, however able to find a similar image. It's located at /System/Library/Frameworks/SecurityInterface.framework/Versions/A/Resources/CertLargeStd.png (at least for Mac OS 10.8.2) and it looks like this:
certificate icon
([email protected] is the one used on Retina screens.)

This is the image shown when you view a certificate in Keychain Access or Safari:
safari screenshot

To find this image, I opened up the Safari panel above. I examined Safari's open files via Activity Monitor, and the image in question was there. Activity Monitor screenshot


The following command in the terminal should search your entire hard drive for .icns files:

find / -iname '*.icns'
  • find is a command for finding files
  • / is the path name for the root directory (you could change this to a different path if you had some idea where the file was located`
  • -iname '*.icns' searches in a case insensitive (i for insensitive in iname) way for files that match .icns where * is a wildcard character

You could copy all *.icsns files on the hard drivein to the /tmp/ folder with a terminal command like this:

sudo find  / -iname '*.icns' -exec cp {} /tmp/ \;
  • sudo runs the command as the super user which may give you access to more directories
  • -exec means execute the following command where {} is replaced by the file returned and \; ends the command

You could then browse the /tmp folder in Finder until you find the file you are looking for. Then once you know its name, you could find it in the path list from the previous find command. or with a new find command. E.g., you learn it is called foo.icns, then enter find / -iname 'foo.icns'