How can I edit "/System/Library/LaunchDaemons/com.apple.nfsd.plist" In Catalina?
I need to edit this file to allow Kodi access to my NFS shares. Before Catalina, I was able to go into recovery mode and disable SiP, make the change and re-enable it.
I just upgraded to 10.15.3 and this method no longer works. I read somewhere that the edit needs to be done through terminal from within the recovery mode but I have no idea how to do this.
If anyone can help, it'd be much appreciated.
Quit all apps!
Boot to Recovery Mode either with cmdR (while booting) or in normal GUI mode from within the shell (Terminal):
sudo nvram "recovery-boot-mode=unused"
sudo reboot
The two sudo commands will reboot your Mac immediately to Recovery Mode without further user interaction (i.e. no cmdR shortcut necessary while rebooting)
In Recovery Mode you are already super user: no sudo
required and thus not even included in the base system. The security measures introduced with El Capitan (SIP) and Catalina (read-only system volume) are not effective.
In Recovery Mode open Terminal (menu bar > Utilities > Terminal), mount the volume in read mode:
mount -uw /Volumes/[name_of_main_volume]
Example with the default name Macintosh HD:
mount -uw /Volumes/Macintosh\ HD
Then enter:
/Volumes/[name_of_main_volume]/usr/bin/nano /Volumes/[name_of_main_volume]/System/Library/LaunchDaemons/com.apple.nfsd.plist
Example with the default name Macintosh HD:
/Volumes/Macintosh\ HD/usr/bin/nano /Volumes/Macintosh\ HD/System/Library/LaunchDaemons/com.apple.nfsd.plist
Replace
<array>
<string>/sbin/nfsd</string>
</array>
with (here I assume you are following the instructions here and want to add -N to the plist)
<array>
<string>/sbin/nfsd</string>
<string>-N</string>
</array>
and hit ctrlO to write the changes to disk and ctrlX to exit nano.
Enter
nvram -d recovery-boot-mode #according to user3439894 and other users you don't have to execute this command
reboot
to reboot normally.
As explained in @klanomath's answer, disable SIP, but make sure you mount /Volumes/Macintosh HD
with read write options inside the recovery mode:
mount -uw /Volumes/Macintosh\ HD
You can then continue with the remaining steps to edit the file.
Then generate and tag new APFS System Snapshot as follows:
-
Create snapshot:
sudo /System/Library/Filesystem/apfs.fs/Contents/Resources/apfs_systemsnapshot -s "SnapshotName" -v /Volumes/Macintosh\ HD
-
Tag snapshot for next boot:
sudo /System/Library/Filesystem/apfs.fs/Contents/Resources/apfs_systemsnapshot -r "SnapshotName" -v /Volumes/Macintosh\ HD
Finally enable SIP and reboot.
Should probably work. Cheers