

Now let's switch to the User we just created, to do that first quit from the current session. Now lets create User with name 'hello_world_user' by running following commands CREATE ROLE hello_world_user WITH LOGIN PASSWORD 'password' Now you are in psql command line, you can start executing SQL queries here. Now you should see output like below MacBook-Pro:~ root$ psql postgres

Now you if you run the postgres -V command then you should see the PostgreSQL if you can see that, your installation is successful. If you want to run PostgreSQL on startup of your macOS then you need to run the following command pg_ctl -D /usr/local/var/postgres start & brew services start postgresql 4. If you want to run PostgreSQL on demand then you can start the service with the following command brew services start postgresqlĪnd you can stop the service with the following command brew services stop postgresql
#POSTGRES SQL COMMAND LINE FOR MAC INSTALL#
You can install PostgreSQL by running following command brew install postgresql 3. Once you have homebrew in your mac, installing any other software is easy. You can install it by running following command /usr/bin/ruby -e "$(curl -fsSL )" 2. So first get Homebrew if you don't have it already. Installing PostgreSQL using Homebrew is the easiest & less hassle way of setting up on macOS. Install Homebrew (If you don't have already) This tutorial helps you install PostgreSQL on your macOS and helps you configure a user & database for your first application using PostgreSQL. PostgreSQL is one of the fast growing object-relational database management system (ORDBMS).
