3

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.

  • Please add your system version – klanomath Nov 9 '15 at 14:52
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

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

You must log in to answer this question.

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