An incorrect command syntax often triggers PostgreSQL user and database creation errors. To fix it, ensure your command ends with a semicolon (;).
Also, you must run the command using the postgres user and the psql command line. To do so, run this command:
sudo -u postgres psql
If your Terminal shows the following, you should be able to create a user and database.
postgres=#

