We recently wrote an article telling you all about what exactly virtual memory was in the context of OS X, what it does, and how you can check how much of it you’re using (using the Activity Monitor, as pictured below). If you can’t be bothered to read the article, shame on you, but to sum it up, while virtual memory can be a very useful to push your RAM to it’s limits, it can also slow down your computer significantly, and many want to know how to disable it.
Here’s how, but it’s not exactly the easiest thing to do and you risk messing up your computer. We hold no responsibility if you mess up your Mac as a result of following this.
1. Open Terminal (Found In Applications > Utilities)
2. Virtual memory on the Mac is controlled by a swap file, and that’s what you’ll need to deactivate. Type this command into the Terminal:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
3. If you want to completely delete the files (really don’t recommend it, as you will never be able to modify virtual memory again), then type this command:
sudo rm /private/var/vm/swapfile*
If you’ve only gone as far as step two and want to reactivate the swap file, type this then close the Terminal:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
I’ll stress again that this is risky stuff, so if you don’t know what you’re doing, don’t try it. Instead, there are some much easier solutions to improving memory performance.
Upgrading the RAM itself is the most obvious one, and you can also run fewer programs at once and create more space on your hard drive. Disabling virtual memory is only something you should do if you have a specific purpose in mind, nothing else.
Before you go
After spending over 20 years working with Macs, both old and new, theres a tool I think would be useful to every Mac owner who is experiencing performance issues.
CleanMyMac is highest rated all-round cleaning app for the Mac, it can quickly diagnose and solve a whole plethora of common (but sometimes tedious to fix) issues at the click of a button. It also just happens to resolve many of the issues covered in the speed up section of this site, so Download CleanMyMac to get your Mac back up to speed today.