4

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.

2
  • Have you tried using Xcode?
    – Natsfan
    Commented Feb 3, 2020 at 4:16
  • I've never used xcode before. I'd like to avoid downloading an 8 gig program to add a single line to 1 plist file, but I suppose if there's no other way, I'll do it.
    – Raven
    Commented Feb 3, 2020 at 4:26

2 Answers 2

3

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.

4
  • 1
    In my experience, nvram -d recovery-boot-mode isn't really necessary as sudo nvram "recovery-boot-mode=unused" doesn't write a persistent entry. I use the latter all the time and then from Recovery Mode just use reboot and it always boots back to a normal mode. Subsequent normal reboots work as expected without having to use nvram -d recovery-boot-mode after having used sudo nvram "recovery-boot-mode=unused". Commented Feb 3, 2020 at 6:08
  • @user3439894 I know, but I haven't been able to test the 2nd last step properly. It doesn't hurt though.
    – klanomath
    Commented Feb 3, 2020 at 6:11
  • Thank you so much for the reply. I will test this later today when I get back from work and report back. However, yesterday when I tried some stuff out, I couldn't use sudo. It told me command not found.
    – Raven
    Commented Feb 3, 2020 at 11:51
  • The file can be modified in recovery mode, but resets back to defaults on the next boot. Attempted twice, the second time I read the change back, and it still is reverted.
    – cmcginty
    Commented Jan 31, 2021 at 22:22
1

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:

  1. Create snapshot:

    sudo /System/Library/Filesystem/apfs.fs/Contents/Resources/apfs_systemsnapshot -s "SnapshotName" -v /Volumes/Macintosh\ HD
    
  2. 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

1
  • Unfortunately, no dice on macOS Big Sur 11.5.1; the changes aren't retained on reboot. Any ideas? Commented Jul 28, 2021 at 1:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .