Mac OS/X won't let me mkdir /usr/share/tomcat6, even as root
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?
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.
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.