Installing PostgreSQL - instructions unclear

In the PostgreSQL tutorial, the following information is presented from DataQuest:

Mac:

  • Download Postgres.app here, move to the Applications folder, and double click to launch. This applications runs in the background and you’ll need it to be running to connect to it from Python. By default, PostgreSQL will run on port 5432 .
  • Add the following line to the end of ~/.bash_profile :
    • export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
  • Reset your terminal by executing source ~./bash_profile

The first item makes sense, but the second is totally confusing. Where can ~/.bash_profile be found? Is this some file on my mac? Is it something I navigate to in the postgres app? or is it something I’ll need to do via the terminal window?

Hey, Chris. You can learn about these things in the command line courses.

In the shell, ~ typically is an abbreviation of /home/your_username, so you can find the .bash_profile in /home/your_username.

In Unix-like systems — like MacOS — a filename whose name starts with . is a hidden file. So I expect that you won’t be able to see it in your file explorer unless you tweak the settings. I’ve never owned or worked extensively with Macs, so I can’t tell you how to solve this particular issue.

What I can do is tell you how to do this through the command line (or terminal window, if you prefer). Open the terminal and run the following commands.

echo 'export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin' >> ~/.bash_profile
source ~./bash_profile

That’s it. Such is the power of the command line.