Run Repair Permissions via an AppleScript

Jan 20, '03 09:14:04AM

Contributed by: mahakali

I'm not sure if this is new. Anyway, I was browsing this forum, looking for a way to enable journal. Then thanks to this thread, I found out there is a way to repair permissions from terminal. The command is:

sudo diskutil repairPermissions /
By combining this with AppleScript, you can easily repair permissions from Script menu or Youpi Key or Quickeys without having to open Disk Utility (which, by the way, isn't scriptable.) To open a new window and run the command, use this AppleScript (you'll need to enter your admin password afterwards):
tell application "Terminal"
do script "sudo diskutil repairPermissions /"
end tell
To run it silently in the background, use this AppleScript:
do shell script "sudo diskutil repairPermissions /" ¬
password "yourAdminPassword" with administrator privileges
Replace "yourAdminPassword" with your admin password. The drawback using this silent command is you wouldn't be able to see the log. I'm wondering if it's possible to get the log from terminal, trigger TextEdit to make a new document with the log and then save it somewhere. Any suggestion?

[Editor's note: If you're going to create an AppleScript with your admin password in it, make sure you put it somewhere safe from potential prying eyes...]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030120061404240