Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example for removing specific account from System Preferences > Internet Accounts for the current user.
# get name of currently logged in user
currentUser=$( /usr/bin/stat -f "%Su" /dev/console )
echo "Current user is $currentUser."
# get current user's home folder
homeFolder=$( /usr/bin/dscl . read "/Users/$currentUser" NFSHomeDirectory | /usr/bin/awk -F ": " '{ print $2 }' )
# remove account by description name from Accounts sqlite database
/usr/bin/sqlite3 "$homeFolder/Library/Accounts/Accounts4.sqlite" 'DELETE FROM ZACCOUNT WHERE ZACCOUNTDESCRIPTION = "Exchange"'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.