Unable to write to /tmp directory in macOS, unable to correct permissions: “Operation not permitted”
Solution 1:
- Reboot your Mac into recovery mode
-
Open Utilities menu in the top bar > open Terminal
csrutil disable
Reboot
-
Remove the tmp folder
sudo rm -i /tmp sudo rm -i /private/tmp
-
Create tmp folder
sudo mkdir /private/tmp sudo chown root:wheel /private/tmp sudo chmod 1777 /private/tmp
-
Create the symlink
sudo ln -s /private/tmp /tmp
-
Run
repair_packages
(you may not need to do this)sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
-
Reboot back to recovery mode and run
csrutil enable
Reboot
Props to Andrew Ferk for figuring out a fix; pulling out your comment as a community wiki answer so it's more readable.
Solution 2:
sudo chmod 1777 /private/tmp
Did it for me.