Under OS X Mavericks and below we just could launchctl unload
the dynamic_pager plist, but trying to unload this plist doesn't have any effect since OS X Yosemite.
What is the new way to disable swap files now with OS X Yosemite?
Under OS X Mavericks and below we just could launchctl unload
the dynamic_pager plist, but trying to unload this plist doesn't have any effect since OS X Yosemite.
What is the new way to disable swap files now with OS X Yosemite?
Have you tried something like this?
# Check installed RAM, disable VM if 8Gb or more.
mem_inst=`/usr/sbin/sysctl -n hw.memsize`
if [ "$mem_inst" -ge "8589934592" ]; then
echo "8Gb+ Memory installed."
if [ "$action" == "unload" ]; then
sudo nvram boot-args="vm_compressor=2"
sudo pmset -a hibernatemode 0
echo "vm.compressor_mode set to 2"
else
sudo nvram boot-args="vm_compressor=4"
sudo pmset -a hibernatemode 3
echo "vm.compressor_mode reset to defaults"
fi
launch_control $action /System/Library/LaunchDaemons com.apple.dynamic_pager
else
echo "Less than 8Gb memory."
fi
This isn't something I wrote, was information I found.
sudo nvram boot-args="vm_compressor=2"
, which might definitely be the correct solution, when looking at apple.stackexchange.com/q/118839/97060. I applied that command and rebooted. Will accept if there's still no swap in a few hours, just to verify ;-) (By the way, everything else in this post except that single command are useless commands...)
– bwoebi
Oct 29 '14 at 11:56
nvram: Error setting variable - 'boot-args': (iokit/common) general error
unless disabling system integrity protection first, then it works
– rogerdpack
Oct 26 '16 at 19:29
Here's what I do:
sudo pmset -a hibernatemode 0
(disables hibernation mode)
sudo rm -rf /private/var/vm/.
*(removes existing swap files)
sudo chflags uchg /private/var/vm/
(locks down the swapfile directory, prevents anything from being written to the folder)
As others have said, though, please only do this if you know what you're doing.
sudo nvram boot-args="vm_compressor=2"
and you're fine.
– bwoebi
Jan 13 '15 at 14:06
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
Tested on freshly installed Yosemite from App Store.
/System/Library/LaunchDaemons/com.apple.dynamic_pager.plist: Could not find specified service
. Also it doesn't have any effect on whether the system is swapping or not. (yes, I did reboot)
– bwoebi
Oct 27 '14 at 18:50