Messed up the /private folder!

permission

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

Best Answer

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.