Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Use Terminal to empty cache

My Safari cache won't empty. What is the Terminal command to do so?

MacBook, OS X Mavericks (10.9.1)

Posted on Jul 22, 2014 9:33 AM

Reply
2 replies

Jul 23, 2014 1:37 AM in response to Terry Brown

You can delete Safari's cache file. First, check its size using the disk usage (du) command:

du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db


Note: Replace "$HOME" with the name of your home folder. You can use the user identity (id) command to find it:


id -un

Next, delete Safari's cache file:

rm /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db

Safari will create a new Cache.db file automatically when you open a new webpage. Open a new webpage or restart Safari and recheck disk usage:

du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db



Warning: when you use the remove (rm)command files are essentially unrecoverable. A more prudent approach is to use the move (mv) command:


mv /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db ~/.Trash/

This will move the file to your user's ($HOME) trash. From there it is still recoverable until you empty the trash.

Use Terminal to empty cache

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.