Skip to main content
Question

Clearing Safari & Chrome Caches on Login

  • January 23, 2017
  • 5 replies
  • 37 views

Forum|alt.badge.img+10

I am using the following script to delete the Safari & Chrome caches upon login. It seems to work but I noticed it doesnt clear the Safari history.

#!/bin/sh

#Remove Safari and Chrome Cache

sudo -u $3 /bin/rm -rf /Users/$3/Library/Caches/com.apple.Safari
sudo -u $3 /bin/rm -rf /Users/$3/Library/Caches/Google/Chrome

Is that set somewhere else?

5 replies

AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • January 23, 2017

Safari History files are found in ~/Library/Safari/


Forum|alt.badge.img+1
  • New Contributor
  • February 15, 2018

Is this script for Mac OS andor iOS? If for iOS, where do you write this script?


johntgeck
Forum|alt.badge.img+7
  • Contributor
  • March 8, 2018

Just wanted to comment that this worked flawlessly for me! I deployed it as a policy in Self-Service and my onsite techs and end users are very thankful.


Forum|alt.badge.img+3
  • New Contributor
  • May 10, 2019

Hey Guys, anyway to clear the safari history only...thank you in advance


jamiesmithJAX
Forum|alt.badge.img+9
  • Contributor
  • November 3, 2022

Just wanted to comment that this worked flawlessly for me! I deployed it as a policy in Self-Service and my onsite techs and end users are very thankful.


any chance you have successfully used this on Monterey?  Just stumbled across this old post today and was trying to replicate exactly what you have done, but unfortunately nothing seems to happen on my devices and all the cached data persists.  Thanks