Apple - Is it safe to remove /vm/swapfile0?

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


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 needs to have this 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. Deleting a file that will just be recreated, likely less contiguously than when you had more space available isn’t a sustainable clean up activity. Consider moving photos, music and movies to external storage or deleting apps if you have no large user files you can clean or move.