Sudo can't create file in /usr/bin in El Capitan
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream
--
Chapters
00:00 Sudo Can'T Create File In /Usr/Bin In El Capitan
00:25 Accepted Answer Score 25
01:10 Answer 2 Score 8
01:40 Answer 3 Score 2
02:09 Thank you
--
Full question
https://superuser.com/questions/933019/s...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#macos #osxelcapitan
#avk47
ACCEPTED ANSWER
Score 25
Since OSX 10.11, Apple reinforced the security system. Called System Integrity Protection, Apple locks down:
/System
/sbin
/usr (with the exception of /usr/local subdirectory)
To disable this security feature you have to reboot your computer and hold CMD+R
at start to boot into OS X Recovery Mode.
Then OS X Utilities > Terminal
Type the command csrutil disable; reboot
Your computer will restart. You will see a confirmation message about the desactivation.
To verified the status of CRS type csrutil status
ANSWER 2
Score 8
As mentioned by Ragnar, the /usr
directory is locked down by the system, with the exception of /usr/local
. Then, if your scenario allows, I'd recommend adding the symbolic link to /usr/local/bin
. If you don't have a strict requirement on using /usr/bin
, that's one way to work around the "Operation not permitted" error.
ANSWER 3
Score 2
One can verify if a particular file or directory is restricted by OSX's System Integrity Protection (SIP)/Rootless by listing the file flags using the -O
option to ls (e.g. to see which directories in / are restricted):
ls -Ol /
The directories or files that are controlled by SIP show as 'restricted'.
There's full details in the answers to this question about SIP/rootless.