Last Updated: December 1, 2023
Location: Canada
Save your SSD life!
Tested with macOS Sonoma Version 14.1.2
Most of the guides online do not work with macOS Sonoma 14.1.1 or later.
Warning: With insufficient memory, the kernel may potentially terminate processes. This guide is recommended for users with ample memory space based on their usage.
(Intel-based Mac: https://support.apple.com/en-ca/guide/mac-help/mchl338cf9a8/14.0/mac/14.0)
-
On your Mac, choose Apple menu > Shut Down.
-
Wait for your Mac to shut down completely.
-
A Mac is completely shut down when the screen is black and any lights (including in the Touch Bar and keyboard) are off.
-
Press and hold the power button on your Mac until the system volume and the Options button appear.
-
Click the Options button, then click Continue.
-
If asked, select a volume to recover, then click Next.
-
Select an administrator account, then click Next.
-
Enter the password for the administrator account, then click Continue.
Note: Disabling System Integrity Protection (SIP) is a powerful operation that should be done with caution. It allows for advanced system modifications, but it also makes your system more vulnerable to security threats. Only proceed if you understand the implications and have a specific need for disabling SIP.
- Menu bar: Utilities -> Terminal
% csrutil disable
- restart your computer, check SIP
% csrutil status
Output: System Integrity Protection status: disabled.
- Check current mode:
% sysctl vm.compressor_mode
vm.compressor_mode: 4
-
1 -> Compress memory: Disabled; Swap memory: Disabled
-
2 -> Compress memory: Enabled; Swap memory: Disabled
-
3 -> Compress memory: Disabled; Swap memory: Enabled
-
4 -> Compress memory: Enabled; Swap memory: Enabled
- Setup boot configuration to disable Swap memory:
% sudo nvram boot-args="vm_compressor=2"
Use% nvram -p|grep compress
to check
- Unload dynamic_pager daemons to prevent it from starting at boot.
% sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
% sudo rm /private/var/vm/swapfile*
- Restart and check compressor mode:
% sysctl vm.compressor_mode
vm.compressor_mode: 2
-
Open Terminal under macOS Recovery
-
Enable SIP without NVRAM Protections & Boot-arg Restrictions:
% csrutil enable --without nvram
- Check status:
% csrutil status
System Integrity Protection status: unknown (Custom Configuration).
Configuration:
Apple Internal: disabled
Kext Signing: enabled
Filesystem Protections: enabled
Debugging Restrictions: enabled
DTrace Restrictions: enabled
NVRAM Protections: disabled
BaseSystem Verification: enabled
Boot-arg Restrictions: disabled
Kernel Integrity Protections: enabled
Authenticated Root Requirement: enabled
This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.
- Restart your computer and check Compressor mode
% sysctl vm.compressor_mode
vm.compressor_mode: 2
Swap Memory Disabled
note: To enable Swap memory back
In the terminal under macOS Recovery:
% csrutil enable
csrutil enable --without nvram: https://developer.apple.com/forums/thread/17452
macOS Recovery: https://support.apple.com/en-ca/guide/mac-help/mchl46d531d6/14.0/mac/14.0
outdated guide: https://windsketch.cc/macbook-disable-swap
vm.compressor_mode: https://apple.stackexchange.com/questions/118839/vm-compressor-mode-vm-compressor-mode-values-for-enabled-compressed-memory-in
Manual page of dynmix_pager(MacOSX): https://www.unix.com/man-page/osx/8/dynamic_pager/
Important: Please be aware that modifying system settings can have significant consequences. This guide is provided as-is, and the author takes no responsibility for any issues or damage resulting from its use.