Skip to content

Instantly share code, notes, and snippets.

@soundsnw
Created June 13, 2019 22:24
Show Gist options
  • Save soundsnw/00e4c23d4dd2140e2fa53f4fd3a58120 to your computer and use it in GitHub Desktop.
Save soundsnw/00e4c23d4dd2140e2fa53f4fd3a58120 to your computer and use it in GitHub Desktop.
#!/bin/bash
loggedInUser=$( /usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk -F’: ‘ ‘/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }}’ )
sudo -u $loggedInUser chflags -R nouchg /Users/$loggedInUser
diskutil resetUserPermissions / $loggedInUser
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment