I had a folder named private in one of my projects and had to change the permissions of it via chmod, however, instead of "private" I did "/private"!

I am an idiot and can't figure out how to get it back. My shell is all messed up now and I am trying to restore the /private folder via time machine and no luck! It starts but then says "Security agent may only be invoked by apple software"

I know this a HUGE mistake and any help would be appreciated. I am on el capitan

  • Possible duplicate of How can I get back a system file after deleting it from my Mac? – grg Dec 23 '16 at 21:20
  • What version of OS X If 10.11 or later this surely should not be doable with default settings of SIP – mmmmmm Dec 23 '16 at 21:56
  • Has anybody tried the easiest thing in the world yet? Use Disk Utility to repair permissions. – Steve Chambers Dec 23 '16 at 22:11
  • @SteveChambers el capitan does not have the repair permissions in disk util anymore – Ronnie Dec 30 '16 at 18:52
  • Whoops, forgot about that, try this in terminal(without the quotes) "sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /" – Steve Chambers Dec 31 '16 at 13:38

If you have a backup and want to learn how to finesse this, try booting in macOS Recovery. Then:

  • From the Utilities menu, select Terminal.

  • Run:

      chmod u=rwx,go=rx "/Volumes/Macintosh HD/private"
  • Reboot.

This will set the permissions to read-write-execute for root and read-execute for anyone else.

Alternatively, try this or see the answer linked by @grgarside (this).

If you don't have a backup or don't want to make things worse — from macOS Recovery, a quick reinstall of the OS will re-write everything that's critical for the system to run without erasing any programs or user data. Don't mess with anything but a clean reinstall unless you are sure exactly how you messed things up and are confident you won't do more damage trying to fix it by hand.

  • I've edited this to mention a backup and the clear "right answer" in my opinion - just reinstall the OS on top of the broken OS. Your system cannot run without proper permissions and ownership of /private - better to cleanly reinstall unless you have time and inclination to "experiment" without risking your data. – bmike Dec 23 '16 at 22:49
  • 1
    Agree on the "inclination" passage, but changing permissions for /private as described won't worsen the state of the system. At the very most, the OP can still reinstall. I'd leave that as the last (time-wasting) option. – giucal Dec 23 '16 at 23:13
  • @guical - 💯on your option being elegant and minimal. if you're skilled at terminal, you probably already know how to fix what you messed up and won't ask here. I'm "editing" for the vast majority of the user base here. My guess is Ronnie is such a user and will give you the answered check once they sort things out. – bmike Dec 24 '16 at 0:20
  • So I was able to boot into recovery mode and when I try and run sudo, it says command no found. I must've really messed things up. I am doing a full restore from time machine in recovery mode and so far it looks like it's working. It has about an hour and a half remaining. I am going back to the previous day before I goofed. – Ronnie Dec 30 '16 at 18:54
  • My fault, there is no sudo in recovery mode, and there is no need for it, since you are indeed root. The correct command would therefore be chmod ..., without sudo. Anyway, a restore should work. – giucal Dec 30 '16 at 20:27

You must log in to answer this question.

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