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.
Asked
Active
Viewed 8,978 times
1
Giacomo1968
- 53,069
- 19
- 162
- 212
delphirules
- 561
- 3
- 10
- 20
-
Possible duplicate of [Why does chown report "Operation not permitted" on OS X?](https://superuser.com/questions/279235/why-does-chown-report-operation-not-permitted-on-os-x) – Giacomo1968 Oct 01 '18 at 23:36
-
First, [the answer below](https://superuser.com/a/1363080/167207) 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? – Giacomo1968 Oct 01 '18 at 23:39
1 Answers
5
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.
Gordon Davisson
- 34,084
- 5
- 66
- 70