I found a file of size 1 GB in /vm/swapfile0, that has not been accessed in a long time, according to last access date value in ls -l.

My assumption is, that this file is left over from an older macOS version. The last access was probably before I upgraded to 10.12. Can I safely remove it?

I also found some files of size 1 GB in /private/var/vm. These have recent access times; both sleepimage and swapfile1 today and swapfile0 two weeks in the past. I think these are in active use.

One side question though: sleepimage has a size of 1 GB, although I have 4 GB RAM installed. How is that possible? Other threads on the topic of sleepimage suggested that the size would match that of the RAM installed in my Mac.

  • 2
    See this question here at AskDifferent for more info about these types of files, especially the sleepimage file. – IconDaemon Jun 4 '18 at 19:16
  • 2
    This is unused, /vm was used during some upgrade or install. Some people report that after a supplemental update it disappeared. If you're running on the latest macOS version, it's safe to delete. – mspasov Jun 5 '18 at 0:38

Boot up in Recovery mode and use the Terminal to remove the swapfile0 file. That is fully safe to do.

  • This is a great answer. The downsides I mention are not even close to the level of “unsafe” so a clear answer seems best to me here. +1 – bmike Jun 5 '18 at 1:40

The system reserves that file and cleans excess on restart. I'd leave it alone whether it's safe or not to prune (or attempt to prune). The system compresses memory and knows to have space to offload any memory that's paged out so there's not a need for 1:1 RAM to swap allocation.

There are many other files you will want to focus on if you feel storage is growing out of check or you want to free up space on a boot drive.

  • Could you give me a hint on what other files I should focus? – user1785730 Jun 6 '18 at 13:31
  • Sure @user1785730 - If you open up the storage tab of about this mac and go through the cleanup / link to the top 3 buckets of storage that might help with advice. Also, I use Daisy Disk to get a second opinion about what files are stored where. Apple puts some stuff in System that I like to know is really photo caches, etc... – bmike Jun 6 '18 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .