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.
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.