Cleaning up temp files in Mac OS X

47,254

Solution 1

Not sure if this helps but i would try Onyx and Appdelete to get rid of applications, seems to do a decent job of getting rid of extra system files, etc.

Solution 2

Mac OS X temporary files are stored in /tmp and /private/var/folders. Your specific Cache and Temporary folders can be found by running the command echo $TMPDIR and/or usr/bin/getconf DARWIN_USER_CACHE_DIR

These locations should be automatically cleared out regularly either through the daily, weekly and monthly "cron" scripts and/or a restart so you shouldn't have to worry about it. You can use tools such as Onyx, Cocktail, Leopard Cache Cleaner, etc. to run these scripts and/or clear your caches and temp files.

The one big exception is Safari's Thumbnail cache does not delete and can be found in your DARWIN_USER_CACHE_DIR under com.apple.Safari.

To find out where most of your disk space is going (and if temporary files are even a culprit) I suggest using a program such as OmniDiskSweeper or GrandPerspective to tell you where all the large files are.

Solution 3

When a backup volume is not mounted, Time Machine has saved hourly snapshots to /Volumes/MobileBackups/ on laptops since 10.7. They are deleted automatically when you start running out of disk space though.

/private/var/folders/ can contain partially downloaded files or files for applications that have been removed. du -sm /private/var/folders/*/*/*/*/ | sort -rn sorts the folders by size.

~/Library/Autosave Information/ can contain old unsaved documents.

~/Library/Caches/com.apple.Safari/Webpage Previews/ was about 700 GB on my installation of 10.7. defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 disables saving the thumbnails.

Safari saves the contents of websites and plain text files to ~/Library/Caches/Metadata/Safari/History/.

If hibernatemode is 3, /var/vm/sleepimage takes up the same amount of disk space as the amount of RAM you have.

/Library/Developer/ wasn't removed when I installed Xcode 4.3. It contained about 2GB of old docset files.

A good way to find large files is to sort files by size in list view after checking calculate all sizes in the view options. You can show hidden files with defaults write com.apple.finder AppleShowAllFiles -bool true; killall Finder.

Solution 4

Another couple of possible set of options for checking what is occupying disk space:

Baseline -- unique among disk scanners in that it has a brilliant snapshot function. So it scans your disk and shows you what is occupying space, but it will save this snapshot. A couple of weeks later, run it again and compare to your last snapshot - it will tell you every file that has changed. This is unique and very very useful, especially before/after installing large software suites.

enter image description here

Daisy Disk -- This is visually the most beautiful of the OS X disk scanners, I always prefer the pie maps visualisation...

enter image description here

Solution 5

I use Disk Inventory X to find what actually eats my space. then reveal that files in finder and delete them if they are not in use anymore

Share:
47,254

Related videos on Youtube

deddebme
Author by

deddebme

Updated on September 17, 2022

Comments

  • deddebme
    deddebme over 1 year

    My 4 months old Mac partition volume is losing space slowly and gradually. I am pretty sure there are a lot of orphaned temporary files laying around in the volume.

    I know where to find the obsoleted temp files in my Windows partition, how about in Mac OS X?

    • Admin
      Admin about 14 years
      Man, this comes up for me quite often. Thanks for asking.
  • deddebme
    deddebme over 14 years
    let me give Onyx a try
  • deddebme
    deddebme over 14 years
    JDiskreport was useful to browse the disk space allocation. I found some orphans file from GarageBand.
  • deddebme
    deddebme over 14 years
    Onyx removes many temp/log files and rebuild some system cache folder. Surprisingly it freed a few hundreds megabytes of file, comparing to gigabytes of space in many "rusted" windows installation.
  • deddebme
    deddebme over 14 years
    oh btw, Appdelete is not freeware
  • jrg
    jrg about 14 years
    Just to add a (late) comment, Mac OS X swapfiles do not 'ever-expand' even under normal system use. I regularly see them disappear again, when exiting memory hungry programs (Safari, I'm looking at you...) and have done since the early versions of Mac OS X.
  • furins
    furins over 10 years
    ~/Library/Caches/com.apple.Safari/Webpage Previews/ is not more used by recent Safari