Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

johndoe123abc

macrumors member
Original poster
Jul 10, 2012
64
0
Hi,

I'm trying to use a shell script to change the default icons of native apps e.g. iTunes, Mail, Safari etc.

I've been trying to use the seticon command line utility that is part of osxutils, mostly because I don't want to have to install developer tools / may encounter a machine without them.

The current code is as follows:

Code:
tell application "Finder"
	
	set icon_path to "/Volumes/Data/Extras/Software/Icons/"
	do shell script icon_path & "util/seticon -d " & icon_path & "icon.icns" & " /Applications/Stickies.app"
	
end tell

The app runs without error, and returns "" as a result, however the icon remains the unchanged. Does anyone know how to fix this, or have another programatic solution that I can use on a non-dev machine?

Thanks!
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
The app runs without error, and returns "" as a result, however the icon remains the unchanged. Does anyone know how to fix this, or have another programatic solution that I can use on a non-dev machine?

Thanks!


There's no need for a tell application Finder block and you need administrator privileges to change the icon for applications in the Applications folder e.g.

Code:
set icon_path to "/Volumes/Data/Extras/Software/Icons/"
do shell script icon_path & "util/seticon -d " & icon_path & "icon.icns" & " /Applications/Stickies.app" with administrator privileges

Put the seticon and icns file in the Resources folder of your app. Look at the path to resource section here

Example :

Code:
set icon_path to path to resource "Outlook.icns"
set seticon_path to path to resource "seticon"
do shell script quoted form of POSIX path of seticon_path & " -d " & quoted form of POSIX path of icon_path & " /Users/kryten/Applications/Stickies.app" --with administrator privileges
 

Attachments

  • Screen Shot 2014-08-24 at 04.52.28.png
    Screen Shot 2014-08-24 at 04.52.28.png
    157 KB · Views: 170
Last edited:

johndoe123abc

macrumors member
Original poster
Jul 10, 2012
64
0
There's no need for a tell application Finder block and you need administrator privileges to change the icon for applications in the Applications folder

Many thanks kryten2, the administrator privileges bit solved the problem!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.