I ran a 'chown' on everything under /usr to a non root user. Meant to run it for /usr/local/ Now I get the error below on opening terminal

login(89809,0x7fff7bac5960) malloc: *** error for object 0x7fc7cb500b40: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

[Process completed]

2 Answers 2


If you can't restore /usr/ from a backup, you could first start up in single user mode (by holding command-S on startup) and run chown -R root /usr/.

On my installation, all files under /usr/local/ were owned by either root or me, a few files under /usr/ were owned by _uucp, and all other files under /usr/ were owned by root:

$ sudo find /usr/local ! -user root ! -user $USER
$ sudo find /usr/!(local) ! -user root -print0|xargs -0 stat -f '%Su %N'
_uucp /usr/bin/cu
_uucp /usr/bin/uucp
_uucp /usr/bin/uuname
_uucp /usr/bin/uustat
_uucp /usr/bin/uux
_uucp /usr/sbin/uucico
_uucp /usr/sbin/uuxqt
_uucp /usr/share/uucp

This would change the owner of the uucp files:

sudo chown _uucp /usr/bin/{cu,uucp,uuname,uustat,uux} /usr/sbin/{uucico,uuxqt} /usr/share/uucp

/usr/local/ does not exist on a fresh installation of OS X. If you only used /usr/local/ with Homebrew, you might delete /usr/local/ and then reinstall Homebrew.

Alternatively, you could use Pacifist to copy the default /usr/ from an OS X installer downloaded from App Store. Doing an upgrade install of OS X from the recovery partition or upgrading to 10.9 might also restore the owners of some files.

  • The single user mode solution worked. But before running chown, I had to run mount -uw / to allow modification of otherwise read only file system
    – Pete_ch
    Oct 13, 2013 at 6:46

I think this is a case where Repair Permissions actually does something useful. It will restore the correct permissions to all the files supplied by Apple which I think is all but those in /usr/local That directory contains stuff you added and so you should be able to recreate.

To Repair Permissions Use Disk Utility.app and select the boot disk inthe left hand list of disks. There will be buttons to Verify or Repair Disk Permissions.

  • I have many files under /usr/!(local)/ that were not included with OS X: for example files that were added by the Command Line Tools package, files added by the installers for MacTeX, Java, and Haskell, and some binaries in /usr/bin that were added by sudo /usr/bin/gem install.
    – Lri
    Sep 28, 2013 at 12:10
  • There is a reason why it is often suggested that you should not add files in /usr/!(local)/ Apple should be left to manage that area
    – mmmmmm
    Sep 28, 2013 at 12:16
  • A) That's why you shouldn't install things to /usr/ except /usr/local/ and B) Repair Permissions is still your best bet to get your system working again.
    – TJ Luoma
    Sep 28, 2013 at 21:15

You must log in to answer this question.

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