3

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?

5

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.

  • I am getting Operation not permitted even in /usr/local - what am I supposed to do? – leonheess Jun 29 at 11:16
3

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.

  • 1
    I don't control where the web app wants its log files to be. Happily, Apple doesn't get to control where I put things – Greg Dougherty Oct 16 '17 at 15:51
  • Same problem as @GregDougherty , I'm trying to run an app I don't have control of. Once again Apple is making my life harder by trying to control what I do. – qbert65536 May 22 '18 at 15:11
  • @qbert65536 There are some legitimate reasons to disable SIP, but "I want to use software that modifies the OS, but was written by someone who doesn't understand macOS well enough to know where to put their files" isn't one of them. Don't blame Apple, blame the developer. – Gordon Davisson May 22 '18 at 16:41
  • 1
    @GordonDavisson Most Unix software, written for generic Unix, doesn't know about, or care about, Apple's restrictions. That's not their fault. It IS Apple's fault for making it hard to use that perfectly valid software – Greg Dougherty May 25 '18 at 15:59
  • @GregDougherty It's not just macOS; from the Linux Filesystem Hierarchy Standard v3.0, section 4.9.1: "Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr." There are good reasons for SIP needing to protect the core OS against malware; some of its restrictions are seriously annoying (but legitimate tradeoffs), but the restriction to /usr/local isn't really significant. It's just forcing you to do something you should've been doing anyway. – Gordon Davisson May 25 '18 at 18:10

You must log in to answer this question.

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