How to install PostgreSQL nine.6 on Mac Bone X (10.vii or later)
PostgreSQL is an open source relational database system that has been around for well over a decade and has proven to exist a corking all around storage choice when developing a web awarding.
In this guide we are going to walk through installing PostgreSQL ix.six on Mac OS X (x.7 or afterward) so that we can eventually kickoff using information technology with a Go application, but you can follow along with this guide to set Postgres for use with pretty much anything, including Rails, Django, or Get.
Once nosotros have Postgres setup we will also wait at adding all of the executables to our path so that we can type things like psql in the concluding in gild to access Postgres. It is important to notation that this step IS Not required to apply postgres, but it is nice to have and then I advise doing it.
Installation
The offset thing we want to do is install PostgreSQL using Postgres.app. Yous tin can find that hither: http://postgresapp.com/.
Postgres.app is about 50mb, and is past far the easiest fashion to setup Postgres on a Mac. It runs like any other y'all would download, can automatically commencement upwards with your Mac, and allows usa to skip a lot of control line steps that used to be required to prepare Postgres on a Mac. Yay for progress!
You can grab whatsoever version you need at the "Other versions" section of the page, just I will be using th emost contempo version which currently uses PostgreSQL 9.6.0.
In one case you lot have unzipped the download you lot will desire to copy the Postgres app to your Applications binder and so open it. You lot might exist asked if you want to open this application considering information technology was downloaded from the internet. Click open.
You lot should now have Postgres running locally, and you should come across a little elephant icon on the top correct section of your menu bar. Click on it and and so click the "Open psql" option.
If you don't see any errors that means everything is working! Congrats!
Now lets get alee and add together Postgres to our path.
Enabling Postgres command line tools
If you are using the default terminal, you are going to want to modify the file at ~/.bash_profile. If yous are using something like Oh My Zsh y'all are going to want to modify the file ~/.zshrc.
To edit this file you likely need to open up it via the concluding, so open up your terminal and type open ~/.bash_profile. You lot can replace the word open with subl or whatever text editor you prefer.
Once your zbash_profile or .zshrc file is open, add the following line to the end of the file:
consign PATH =$ PATH : / Applications / Postgres . app / Contents / Versions / latest / bin After that yous will need to quit and restart your final This is to brand sure information technology reloads with the changes you just made.
In one case yous have restarted your terminal, try running psql.
You should get the post-obit output.
psql ( 9 . 6 . 0 ) Type "help" for assist . postgres =# You have at present successfully continued to Postgres using the postgres role. This role doesn't require a countersign because Postgres is only accessible locally, so it is unlikely to nowadays any security bug.
Up Next…
At present that you have PostgreSQL ix.6 installed you are ready to outset using it! Check out the adjacent article in this series to learn how to practise that - Creating PostgreSQL databases and tables with raw SQL
Y'all tin can also bank check out an overview of the entire series, forth with links to each article in the series, by going here - Using PostgreSQL with Golang.
Learn Web Development with Become!
Sign upwards for my mailing listing and I'll send y'all a Free sample from my course - Spider web Development with Go. The sample includes nineteen screencasts and the kickoff few chapters from the book.
Yous will also receive emails from me nearly Go coding techniques, upcoming courses (including FREE ones), and course discounts.
©2018 Jonathan Calhoun. All rights reserved.
DOWNLOAD HERE
Posted by: johnsonaptably.blogspot.com

0 Comments