How can I create a new user through terminal macOS 10.14
#!/bin/bash

USERNAME=per1
FULLNAME="Period 1"
PASSWORD="test"
SECONDARY_GROUPS="staff" 

# ====

if [[ $UID -ne 0 ]]; then echo "Please run $0 as root." &amp;&amp; exit 1; fi

# Find out the next available user ID
MAXID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1)
USERID=$((MAXID+1))

# Create the user account
dscl . -create /Users/$USERNAME
dscl . -create /Users/$USERNAME UserShell /bin/bash
dscl . -create /Users/$USERNAME RealName "$FULLNAME"
dscl . -create /Users/$USERNAME UniqueID "$USERID"
dscl . -create /Users/$USERNAME PrimaryGroupID 20
dscl . -create /Users/$USERNAME NFSHomeDirectory /Users/$USERNAME

dscl . -passwd /Users/$USERNAME $PASSWORD


# Add use to any specified groups
for GROUP in $SECONDARY_GROUPS ; do
    dseditgroup -o edit -t user -a $USERNAME $GROUP
done

# Create the home directory
createhomedir -c -u $USERNAME &gt; /dev/null

echo "Created user #$USERID: $USERNAME ($FULLNAME)"