5

I need to vim the file found at /System/Library/LaunchDaemons/com.apple.pfctl.plist but the permissions will not allow it. Even when I run sudo vim /System/Library/LaunchDaemons/com.apple.pfctl.plist and enter my password, VIM throws me a warning and says that I'm editing a readonly file. Any ideas how to do this?

I'm running OS X 10.11 El Capitain.

1
  • Please add your system version
    – klanomath
    Nov 9, 2015 at 14:52

3 Answers 3

5

Some paths and applications in El Capitan are protected by System Integrity Protection. Even root can't modify the files. You first have to disable SIP before editing or modifying them.

  1. Reboot your Mac to Recovery Mode by restarting your computer and holding down CommandR until the Apple logo appears on your screen.
  2. Click Utilities -> Terminal.
  3. In the Terminal window, enter in csrutil disable and press Enter.
  4. Restart your Mac
  5. Modify the file(s)
  6. Reboot your Mac to Recovery Mode by restarting your computer and holding down CommandR until the Apple logo appears on your screen.
  7. Click Utilities -> Terminal.
  8. In the Terminal window, enter in csrutil enable and press Enter.
  9. Restart your Mac
1
  • 1
    This method is not working for macOS Big Sur. Any other recommendations?
    – COzkurt
    Jan 24, 2021 at 23:37
2

If you are trying to enable PF at startup, you can also try the following*.

In System Preferences / Security & Privacy / Firewall Options..., check "Enable stealth mode" and turn on Firewall.

Somehow this enables PF. You can check by running sudo pfctl -s info.

*Tested on High Sierra and Mojave

0

In Mac Catalina 10.15.6, I couldn't edit com.apple.pfctl.plist after running csrutil disable and restart OS.

I restart to Recover mode -> execute csrutil disable in terminal -> Restart to Recover mode -> then mount OS Volume by Disk util -> then edit com.apple.pfctl.plist in terminal -> then executed csrutil disable -> restart to normal mode -> done

2
  • Why do you need to edit this file? Might there be another method of achieving the same end result?
    – benwiggy
    Sep 22, 2020 at 7:01
  • I need to enable pfctl by default after turning on computer. Sep 30, 2020 at 16:51

You must log in to answer this question.

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