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.
I do not believe that is a good idea. Could it let very RAM hungry application crash?
Wow – super-old post, but really helpful. Did this on my Mac Pro with 128GB of RAM…not really useful for me, and just burns write cycles on my SSDs.
And yes, it could cause RAM hungry apps to crash, but if you’ve got a massive amount of RAM and know you’ve got the headroom, you’ll be fine.
If you have a massive amount of RAM, I suppose the mac will not use Virtual memory a lot and therefore will not burn write cycles on your SSD, so you might as well leave it on for the few times you do run out of RAM. Can’t hurt, but it can help.