I can't seem to change the permissions (let alone delete) anything in directories like /usr/local (which I should be). My research has indicated that it's due to OSX automatically setting everything to be immutable. I was able to work through my problem by booting into single-user mode and remounting the partition with -uw. From there I was able to use chflags to remove the immutability.

However, I would REALLY love to not have to do this every time. Is there a way I can disable immutability globally across the system? Is there a reason I shouldn't?

  • I think you need to start by figuring out why your entire filesystem is getting marked immutable. Does it happen reproducibly? Do you have any messages in any of your logs? Have you tried running Permissions Repair from Disk Utility? Have you tried resetting home directory permissions? – D.W. Jul 23 '14 at 0:47
  • @D.W. so, I kept digging deeper. Turns out somewhere down the line a new user called root was created on my system. I had to force uid=0 on that user. Now things run much more smoothly. Although the immutability is still interesting. Any reason why OSX does it that way? – n0pe Jul 23 '14 at 1:04
  • OS X doesn't do it that way -- something else is doing it (and probably also created the bogus root account), and you're going to have to do some troubleshooting/fault isolation to figure out what that is. BTW, the root user you mentioned: was that in addition to the normal root account, or did it just mess up the normal root account? – Gordon Davisson Jul 23 '14 at 5:03

The root user should always be able to change permissions on the filesystem. I believe things are made immutable by default to help avoid footguns by people who try to copy/paste things from the Internet. Requiring a root password may give people some pause, or at least give them the idea that changing files in /usr/local at random may not be a good idea.

Homebrew, the Mac package manager, makes /usr/local writable to be able to install packages from the web without needing to use the sudo command every time. It runs the following two commands to achieve that:

sudo chmod 775 /usr/local
sudo /usr/bin/chgrp "admin" /usr/local/<unwritable directories/files below this>

You must log in to answer this question.

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