- Read Tutorial
- Watch Guide Video
In this guide, we're going to talk about how to install the Postgres database.
If you're new to it, Postgres is a SQL database, which means it's a relational database like MySQL and SQL. If you're new to programming and unfamiliar with databases, just think of it as a spreadsheet or location where you can store the data from your application, and retrieve the data when you need it. For example, if you created a blog, the database is where you would store all your blog content.
Ways to Install Postgres
There are many ways to install this database. One way is to use Homebrew, and you can do that in the terminal with the command, brew install postgresql
.
Another other way is to go to postgresapp.com, and download it from there. Personally, I'd recommend this option, especially to new developers.
When you click on the download button, it downloads to your system, and also gives you detailed instructions on what you should do.
One of the reasons why I recommend installing it through the webpage, is that if you click on the icon you will get all kinds of information about the database. You can see the port it is running on, which version you have, and open the database right from there.
Once your download is complete, move the file to your applications folder. Then, right-click on the file, and click on Open. This will ask you if you want to run it because it's from an unidentified developer. Go ahead and say yes and go thru the rest of the installation steps.
After installation, you can check if it's working. Right click on the icon (profile of an elephant) in your top menu bar and choose Open spql. This should open a dialog box. You can then hit control c to get out of the system and then you can close the dialog box.
One of the great things about rails is that it gives us a direct connection to our database, so we do not have to directly access it very often.