Skip to content

Instantly share code, notes, and snippets.

@junxy
Created April 16, 2015 02:12
Show Gist options
  • Save junxy/545a1c42880c4f493359 to your computer and use it in GitHub Desktop.
Save junxy/545a1c42880c4f493359 to your computer and use it in GitHub Desktop.
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment