0

I need to edit a script in /usr/bin, but the system won't me let do it because the SIP. How can I do it? It's a PHP script needed for my development environment.

  • Possible duplicate of Why does chown report "Operation not permitted" on OS X? – JakeGould Oct 1 '18 at 23:36
  • First, the answer below is utterly correct. You should not disable SIP unless you have a very strong reason to do so. That said, you state “It's a PHP script needed for my development environment.” This makes no sense. I develop in PHP on macOS—web and system script level—and utterly nothing I have ever encountered required I install anything in a deep system path on macOS like this. You might be asking a different question than what you intend; perhaps you should actually explain why you need to install a PHP script in /usr/bin/ to begin with? – JakeGould Oct 1 '18 at 23:39
4

In general, the best answer is: don't. Changing things in the protected directories may break parts of the OS that use them. Local customizations belong in /usr/local rather than the main hierarchy, and /usr/local/bin is already in the default PATH (and before /usr/bin and /bin, so commands there will be used in preference to the builtins). Just put the modified script there, and it should work for most purposes.

If you do need to make mods in /usr/bin, you can turn off filesystem protection by restarting in recovery mode, and running the command:

csrutil enable --without fs

...then restart normally, do the changes, then restart in recovery again, run csrutil enable, and restart again. See Rich Trouton's blog for way more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.