Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file.icns that I would like to set as custom icon for a folder. How can I do it from a script/command-line? The script is executed in the postinstall phase of a package installer. The language of the script can be any of the script languages supported by the package-maker (bash,perl,applescript should be fine).

share|improve this question

1 Answer 1

I found this (I did not test, but appears to be what you want):

http://hasseg.org/stuff/assignIconScript/assignIcon

share|improve this answer
    
The linked solution uses utils from the Developer Tools. But, since the script must be executed by an installer package, this cannot possibly work, unless those tools are distributed inside the package, which of course I'm not allowed to do. –  Valerio Schiavoni Jun 29 '10 at 18:02
    
@Valerio Perhaps I'm missing something obvious, but folder icons are supplied by an invisible file called Icon within the folder. Why can't your installer package install this file along with everything else? –  ghoppe Jun 29 '10 at 18:55
    
how would I do that? –  Valerio Schiavoni Jun 29 '10 at 21:37
2  
I eventually found a little Obj-C script that does perfectly the job: macgeekery.com/sites/macgeekery.com/files/SetIcon.m –  Valerio Schiavoni Jun 30 '10 at 7:51
    
The assignIcon script doesn't work for me. I get an error: #<stdin>:1: ### /Developer/Tools/Rez - SysError 0 during read. –  e40 May 16 '12 at 18:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.