If sudo purge
didn't help, try disabling dynamic pager, e.g.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
Warning: This completely disables the Mac OS X paging ability, so use it only when you've huge amount of RAM, but your Mac is still using swap files. If your system has SIP protection, you'll have to disable it first (not recommended).
You can also remove swap files manually from /private/var/vm/
, e.g.
sudo rm -f /private/var/vm/swapfile*
then restart the computer.
Source: Mac Virtual Memory – What it is, the Swap Location, and How to Disable Swap
To disable memory swapping completely, set vm_compressor
to 1
, e.g.
sudo nvram boot-args="vm_compressor=2"
or set it to 4
to default, see the other values (from vm_pageout.h
):
#define VM_PAGER_DEFAULT 0x1 /* Use default pager. */
#define VM_PAGER_COMPRESSOR_NO_SWAP 0x2 /* In-core compressor only. */
#define VM_PAGER_COMPRESSOR_WITH_SWAP 0x4 /* In-core compressor + swap backend. */
#define VM_PAGER_FREEZER_DEFAULT 0x8 /* Freezer backed by default pager.*/
#define VM_PAGER_FREEZER_COMPRESSOR_NO_SWAP 0x10 /* Freezer backed by in-core compressor only i.e. frozen data remain in-core compressed.*/
#define VM_PAGER_FREEZER_COMPRESSOR_WITH_SWAP 0x20 /* Freezer backed by in-core compressor with swap support too.*/
To check your current value, run:
sysctl vm.compressor_mode
To back to normal, delete boot args by:
sudo nvram -d boot-args
restart and reset your NVRAM.
See: vm_compressor=VM_PAGER_DEFAULT in Yosemite caused freeze when physical memory was full