I am using Mobile simulator and virtual machines which memory intensive. There are a few posts on internet about how to change the location of Swap files on macOS versions with System Integrity Protection (SIP). The simplest solution without tinkering with OS internals seems to be running the below shell command after boot:
sysctl vm.swapfileprefix=/Volumes/Swap/s
(here /Volumes/Swap is the new swap directory)
But unless SIP is disabled this command can't be executed. There should be a way to configure this on startup as I can't keep SIP disabled just to execute this command. Does setting this in /etc/sysctl.conf work on macOS? Has anyone of you tried this? This solution is suggested in this post from 2015 for older versions of macOS when SIP didn't exist.
How can I move virtual memory swap files to a different drive or partition?
Open to any other alternative solutions. Sorry for cross posting but I didn't get any constructive replies on Apple forum.