Hello everyone, welcome to another Hackintosh tutorial. In this article, I will try to install PostgreSQL server on my macOS Catalina Hackintosh. I haven’t done this before so let’s find out if this is work or not. Installing PostgreSQL on macOS is pretty similar to the Linux installation. I am going to use Homebrew to get the PostgreSQL server up and running.
Steps to Install PostgreSQL Server on macOS Catalina
Step 1. Install Homebrew
Open Terminal and then paste this command to install Homebrew. Homebrew is a clever application that will help us to install almost anything on macOS.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Press Enter to start the installation.
This process will download some files from the internet. So, make sure you are connected to the internet during the installation. Make sure the installation finish successfully as follow:
Step 2. Install PostgreSQL using Homebrew
Now lets install PostgreSQL with this command
brew install postgresql
Again, this process will download files from the internet. Wait until the installation process completes.
Now lets check the PostgreSQL version
At this point, the PostgreSQL Server is installed.
Step 3. Configure the PostgreSQL Server
Now we are going to initialise the database.
As you can see, the command result in error
initdb: error: directory "/usr/local/var/postgres" exists but is not empty. If you want to create a new database system, either remove or empty the directory "/usr/local/var/postgres" or run initdb with an argument other than "/usr/local/var/postgres".
That is fine. This means that we already have the database in the directory. This process was automatically created a new database called “postgres”.
Start/Stop PostgreSQL Database Server
Use the following command to start and stop the server:
pg_ctl -D /usr/local/var/postgres start pg_ctl -D /usr/local/var/postgres stop
Connect to the database
To connect to the database, use psql command. For example:
The command will connect to the database “postgres“.
That’s it. We have just installed PostgreSQL Server on macOS Catalina. I have tested this on my Intel Hackintosh system. Next time, I will try it on my AMD Hackintosh.