Macbook's harddrive free space changes seemingly randomly
Solution 1:
To find out what takes up space, you can use Disk Inventory X, http://www.derlien.com/, which is free, or DaisyDisk, http://www.daisydiskapp.com/, also in the Mac App Store.
Solution 2:
Checking the space
You can use OmniDiskSweeper to check what is occupied your space. It's free.
Or, if you like command-line, run Terminal.app and enter this:
du -kx /some/directory | sort -nr > $HOME/DiskUsage.txt
less $HOME/DiskUsage.txt
you will get sorted size-list (in kB) for all directories under the /some/directory.
Swap files
Another check - swap file. If your apps take more memory as you have, the OS do "swap" parts of memory into HDD. (In the linux or FreeBSD there are usually dedicated HDD partitions (slices) but on OS X these are files.
You can check their size with:
ls -l /private/var/vm
you will get something like the next:
total 12582912
-rw------T 1 root wheel 4294967296 23 jún 14:30 sleepimage
-rw------- 1 root wheel 67108864 15 jún 09:03 swapfile0
-rw------- 1 root wheel 67108864 23 jún 14:54 swapfile1
-rw------- 1 root wheel 134217728 23 jún 14:54 swapfile2
-rw------- 1 root wheel 268435456 23 jún 14:54 swapfile3
-rw------- 1 root wheel 536870912 23 jún 14:54 swapfile4
-rw------- 1 root wheel 1073741824 23 jún 14:54 swapfile5
As you can see, in my HDD are now 5 swapfiles with total size 2GB. When start too much programs (or have 50 browser windows or soo) sometimes the swap increases up 5 GB or more. Simply close applications and the swap will be freed.
The another 4GB file (sleepimage) is the space, where OS X store its memory content when going to sleep (SafeSleep - storing memory content in the file). While it is possible turn of the SafeSleep and get 4GB HDD space (or less, if you have less memory) via pmset command, i do not recommend this.
Browser
When you browsing a lot, Safari storing some content into his cache/files. You can partially clear from the menu: Safari -> Empty Cache
Or simply check your cache files in the $HOME/Library/Caches
with the OmniDiskSweeper or the du -kx $HOME/Library/Caches | sort -nr
command from the Terminal.
You can Trash everything from the $HOME/Library/Caches without problems, but (for the safe) is better relog or reboot after the delete.
Logfiles
Another space-waste can be the Logfiles. You can check them with your Console.app (Utilities). (in the bottom left corner it showing the current size) - You can trash a big ones from the application directly.
Solution 3:
I agree with all of the above and I've had great luck with Disk Inventory to identify how many large files were quietly sitting there including many duplicates.
I can only add a number of suggestions of other small things that might collectively help you recover HD space.
I'm not sure what OS you're running but Snow leopard used 4 Gb less HD space that Leopard on my iMac.
iDVD and GarageBand are very large applications and you could uninstall them if you don't use them. If you do use them, they have large folders with templates so possibly you could delete some of these templates.
Check activity monitor for memory pages outs. This is similar to Windows pagefile and if this number is high, it means you're consuming HD space when there isn't enough ram to manage everything that is running on your machine. Add more ram, page outs goes down and frees up HD space.
Check to see if the Login Items that start automatically are really apps that you need to run automatically. Go to system preferences, accounts, login items and delete any that aren't required by highlighting the app and clicking on the minus sign. This can free up ram and reduce page outs.
Reduce the number of widgets in dashboard. Collectively they may have grown and can consume ram and in turn generate extra page outs. On my laptop, I had 12 and now get by with 2.
Spotlight automatically indexes almost your entire drive. Open system preferences, spotlight and de-select the items that you can exclude from indexing. I reduced my indexing from 14 categories to just 7.
In addition to the main Trash bin, mail and iPhoto have dedicated trash bins to be emptied. I never knew iPhoto had its own trash and recovered almost 1gb when I emptied the iPhoto trash.
Solution 4:
The one thing to remember is that MacOS is a Unix variant, and these kinds of systems use considerable amounts of disk space as system cache. In fact, even if you run out of physical ram, your system doesn't see this and immediately starts using available disk space to handle active tasks. It can be that just by running, you're using up that space.
Typically for a Mac, you should always keep at least 5-7GB free, to handle memory requests, caching, swapping in and out, etc. 1GB is asking for trouble...you might also notice that the machine starts going slower and slower, especially now that it needs to search for available blocks of open space, randomly scattered across your disk.
I would suggest a few things:
• Back everything up now. I bought a 2GB external drive for €70, partitioned it for Time machine and File backup, and backed-up the disk (in one partition) and the files via Time Machine in the other.
• Use an application like Snow Leopard Cache Cleaner to run through the system and flush caches and delete extra languages and old PPC-based code in apps. That will free up some space.
• Try to clean off your disk so there's at least 10Gb free on the boot disk. Back up any large files to an external disk...OS X will automatically run in the background and defrag any files under 20MB on the fly, but you can use Snow Leopard Cache Cleaner to Optimize files afterwards. Move old, large files off (like an iTunes library) clean up the drive, and then migrate the important files back.
You shouldn't need to reinstall anything - just don't let the drive fill-up!