Chrome - Clear History, Cache, Cookies on Restart

New Contributor

Trying to have all users' computers restart every morning;

I have a script that kills all processes and restarts after 1minute. I need a script to also remove the cookies, history, and cache of Chrome on said restart so they essentially start "fresh" each day without losing their extensions.

Tried this but it's not working:


Remove Google Chrome Browser Cache Cookies and Extension Logins

sudo rm -Rf ~/Library/Caches/Google/Chrome/Default/Cache/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/Cookies/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/Cookies-journal/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/Extension/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/Extension-journal/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/History/
sudo rm -Rf ~/Library/Application Support/Google/Chrome/Default/History-journal/



New Contributor III

Did you find something already ?

New Contributor

Looking for this exact thing as well.

Contributor III

Me too, as well as Safari data, but I know there are SIP issues relate to that.

New Contributor II

This is what I use for Cookies, but could be easily modified to include everything else you need.

## System Variables
USERNAME=`stat -f%Su /dev/console`
COOKIEPATH="/Users/$USERNAME/Library/Application Support/Google/Chrome"

find "$COOKIEPATH" -name Cookies -delete

pkill Google Chrome

New Contributor III

I want to do the exact opposite. I want to keep the students from deleting their browsing history. Is that doable 🙂 is there a script for that?

New Contributor II

Check out Chrome Management, there's built-in functionality with JAMF Pro now. which makes enrolling browsers very easy, one of the policies you can set once enrolled is not being able to delete history.

Have just rolled this out so feel free to shoot through a DM if you have any questions.

New Contributor III

For iPads? IOS

New Contributor II

I haven't tried it on iOS but from what i've seen its only for MacOS, Windows, Linux and ChromOS

New Contributor II

I've just checked it out and looks like there is the ability for iOS devices. unsure on the enrolment process for ipads though.Screen Shot 2021-11-04 at 9.23.11 am.png