Brew Postgresql

  
Postgresql

I wanted to point out some straightforward commands for doing this database upgrade on your Mac, if you, like me, have ignored doing so. This post from Olivier Lacan was a great help and I just wanted to make it even clearer that it's this easy:

Once Homebrew is installed, you can install PostgreSQL by issuing the following commands in your terminal: $ brew update $ brew doctor $ brew install postgres The first two commands are used to update Homebrew and report any potential issues (if necessary). Then, of course, brew install postgres is the one-line command for installing PostgreSQL. Homebrew is a package manager for Mac OS X that builds software from its source code. It includes a version of PostgreSQL packaged by what it refers to as a formula. This type of installation might be preferred by people who are comfortable using the command line to install programs, such as software developers. Typical use looks like. To install postgres with brew I used: $ brew install postgres To see if postgres is running I can type: $ brew services Name Status User Plist postgresql stopped Then the funny thing was when I tried to start the service: $ brew services start postgres Successfully started `postgresql` (label: homebrew.mxcl.postgresql) Great! So it's running!

Glorious! Here's what the original error looked like for me, for SEO juice and future reference:

So, I ran the above commands - here's the full output in case you're curious.

I hope that helps someone in the future!

P.S.: Cleanup!

PostgresqlBrew

If your app works well once you've upgraded - your 'old' Postgres 12 might take up a ton of space:Knives out imdb.

You can clean that up with:

Brew Postgresql

This article was last updated on November 19, 2020

This is a quick guide for installing PostgreSQL (Postgres for short) on a Mac with Homebrew, and starting and stopping it with Homebrew Services. If you're working on a Ruby on Rails project that requires Postgres, this tutorial will get you up and running in no time.

The easiest way to install Homebrew, Postgres, and all the othertools necessary for Ruby on Rails development, is to run my free script that will set everything up for you.

If you prefer to do things manually and hope for the best, follow the steps below.

Step 1: Install Homebrew

Follow the instructions on their site.

Brew Postgresql Tutorial

Step 2: Update Homebrew

Brew Postgresql Client

Before you install anything with Homebrew, you should always make sure it's up to date and that it's healthy:

Step 3: Install Postgres

When you install Postgres, Homebrew will provide useful information in your Terminal that you should read. Homebrew also helpfully creates a default database cluster. You can confirm that if you see the following output:

Brew Postgresql Logs

Step 5: Start the Postgres service

At this point, you should be all set to run the Rails commands to create and use the database in your app.

Brew Postgresql-upgrade-database

To stop Postgres:

Brew Install Postgresql

To see a list of all services and their state: