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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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 Account.