I've been going through and cleaning up my system, updating the tools, frameworks and languages that I have installed on my local machine.
While doing this, I realized I had never installed postgresql through the package manager, Homebrew. And since as of this moment, I don't have any critical projects using my local setup, I decided to go through the pain of setting up things right once, so that I don't have to worry about it in the future when wanting to easily update or remove any packages.
Homebrew is like NPM or Rbvm in the sense that it's a package manager, meant to help you easily update, remove, or add packages.
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system and Linux. The name is intended to suggest the idea of building software on the Mac depending on the user's taste. Originally written by Max Howell, the package manager has gained popularity in the Ruby on Rails community and earned praise for its extensibility. Homebrew has been recommended for its ease of use as well as its integration into the command line. Homebrew is a non-profit project member of the Software Freedom Conservancy, and is run entirely by unpaid volunteers. - per wikipedia
First I needed to figure out how to delete my original install that's not through Homebrew.
Let's back things up
🜲 pg_dump -d informo-backend_development -n public -f informee-backend.sql
Now you have your back up of a singular database.
We can worry about this later on, when we need to import it back.
But for now, we can celebrate that we did one thing right, hurrrray!
Next, uninstalling postgresql from your machine. We should check which version of psql you have installed using the command
psql -I -version
Mine was 10.10 so I then ran the command
But I got an error that said I didn't have that installed there.
I took a short cut and used my AppCleaner app that located where all the files where after dragging and dropping my app. Also as a side note, I ended up getting the yearly subscription for CleanMyMac X after diving in to see if there was a better alternative.
brew update before installing and then
brew install postgresql
after which you can run
which psql to check the version that was installed.
Here's areas where I ran into problems
1) Adding the Postgress App
When I downloaded the app after installing the latest psql version through homebrew, I kept getting an error stating
Binaries not found.
I thought it was a million things like, I had deleted the wrong core files, installed in the wrong place due to homebrew, etc. I wondered if it was even possible to run the app alongside the homebrew installation r if I was just going got have to default to using the installer like a noob.
After much searching through stackoverflow and the like, I found this
Upgrading from pre 9.5 instructions are not clear #399
Which all grunting aside was pretty great, I realized I had to click the side tab and the create a new server. That was it! Apparently the default server it came with was pointing to the psql -v 10 and I need 11, which creating a brand new server solved.
2) Setting up PgAdmin
The core of the issue was this, after installing, opening a new window and entering my default password, I went ahead and tried adding my server. Thankfully, this stackoverflow post helped me pgAdmin and PostgreSQL: can't connect to server
But everytime I entered my hostname, and the server name, I got a
connection refused error.
Okay let's open up the database from the Postgress App we just got working.
Click on a database and a terminal window opens. You're in the matrix.
Now we type
SHOW port; port ------ my_port_number_here (1 row)
Cooool. How about the host name?
SHOW listen_addresses; listen_addresses ------------------ localhost (1 row)
Oh, I was using my machine name and not the
Once I added the correct info, the database gates opened and I had my db's showing on the page.
Photo by David Clode on Unsplash