MacOS – Oops ā€” deleted swap files (Mac OS, 10.6) ā€” will they come back

macossnow leopardvirtual-memory

I'm worse than my grandmother when it comes to computers. So I got a Mac as my friends who know me and know a bit about PCs said I'd fair better with a Mac. They were right and I love my Mac Book Air.

But I noticed over the last couple of days that everything was running a LOT slower and that my Microsoft Excel & Powerpoint each crashed twice (which otherwise NEVER happens — have owned it for 2 years).

In trying to clean up some files, I foolishly deleted swapfiles, as I was worried I had downloaded some mega files (6 files, each over 1 Gb!) from the internet (although I am cautious when it comes to downloading anything!).

Of course only after the fact did I poke around on some forums and saw that these files seem pretty important to the running of the system.

How can I get them Back? Will they just come back once I start using my Mac again? I also have a Time Machine backup, so should I look there? I"d rather avoide re-booting everything if possible.

FOLLOW-UP: Thanks for the answers below! I will INDEED be more cautious in the future! Real quick: re-boot is the same as re-start, correct? I hope it is, because I'm not sure if I have all the software to re-install everything. Please let me know; thanks again!

2nd FOLLOW UP: If I have to re-boot, do you think a safe boot would suffice? Would that mean I could avoid having to re-install software, e.g., Word & Powerpoint?

3rd FOLLOW-UP: If the swap files again get SO big, will re-starting the computer clear them?

Apologies that my questions are sort of pathetic — I probably shouldn't be allowed to touch a computer šŸ˜‰

Best Answer

To re-create swap files, you should restart the Mac (a normal shutdown is all that's needed). Swap files get cleaned up each and every reboot whether you attempted to mess with them or not.

I used the word attempted since you can't really delete a swap file from under the system due to how unix (the underpinnings of Mac OS X) works. The best you can do is remove the entry in the filesystem that points to the swap file, but any file doesn't get deleted until all files that were using the file are done with it.

Since swap files contain the state of the machine while running, they are marked to not be backed up since they change from second to second and get recreated each boot. To back them up would simply waste space on the backup and time of the system.

You picked a good system file to delete - next time be sure to ask first before deleting other files since many system files are not as forgiving when you delete them from a system and then reboot things.