Advertisement
mekkablue

Clean Font Caches (10.6+)

Feb 22nd, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Cleaning Font Caches in OS X 10.5+
  2.  
  3. # Sources:
  4. # http://www.macworld.com/article/1139383/fontcacheclear.html
  5. # https://www.extensis.com/support/knowledge-base/clearing-the-mac-os-x-font-cache/
  6.  
  7. do shell script "atsutil databases -removeUser"
  8. try
  9.     do shell script "sudo atsutil databases -remove" with administrator privileges
  10. on error errMsg number errNum
  11.     log "Fontcache error #" & errNum & ": " & errMsg
  12.     log "No admin privileges to execute 'atsutil databases -remove'"
  13. end try
  14. do shell script "atsutil server -shutdown"
  15. do shell script "atsutil server -ping"
  16.  
  17. # Tell the user to reinitiate the login process:
  18.  
  19. set buttonAnswer to text of button returned of (display dialog "It is strongly recommended that you restart your Mac, or at least log out and back in again." with title "Fontcaches cleaned" with icon caution buttons {"Restart", "Log out", "Later"} default button 3)
  20. if buttonAnswer is "Log out" then
  21.     tell application "System Events" to log out
  22. else if buttonAnswer is "Restart" then
  23.     tell application "System Events" to restart
  24. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement