13

Running MacOS Sierra (10.12.6)

me $ sudo su root
sh-3.2# bash
bash-3.2# pwd
/usr/share
bash-3.2# mkdir tomcat6
mkdir: tomcat: Operation not permitted
bash-3.2# chmod g+w /usr/share/
chmod: Unable to change file mode on /usr/share/: Operation not permitted
bash-3.2# chflags nouchg /usr/share/
bash-3.2# mkdir tomcat
mkdir: tomcat: Operation not permitted
bash-3.2# chmod g+w /usr/share/
chmod: Unable to change file mode on /usr/share/: Operation not permitted

I have a web app that expects to find log files in /usr/share/tomcat6/logs/. Since such a directory doesn't exist, I'm attempting to create /usr/share/tomcat6, and then make a soft link from there (called logs) to the actual logs directory.

How do I defeat OS/X and get my way?

2

2 Answers 2

14

That's because the /usr folder, with the exception of /usr/local, is protected by System Integrity Protection (SIP).

Check this Apple support page for more details on SIP. This answer gives details on how to disable SIP and more info.

0
8

Locally-installed software belongs in /usr/local, not /usr. This has been a good idea roughly forever, and starting in OS X El Capitan, this is enforced by System Integrity Protection. It's possible to disable SIP, but really it's better to do things right and use /usr/local/share instead.

2
  • what about standard path like /usr/src? I cannot create it either Feb 17 at 7:06
  • @AlexeiS The same organization applies; sources you're installing locally belong in /usr/local/src (which you should be able to create). Feb 17 at 7:38

You must log in to answer this question.

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