Add and Remove users from admin group via command line

To make a user an admin user do the following, replacing “test” with the users name

sudo dseditgroup -o edit -n /Local/Default -a test -t user admin

To remove a user as an admin user do the following, replacing “test” with the users name

sudo dseditgroup -o edit -n /Local/Default -d test -t user admin