Analytics cookies. We use analytics cookies to understand how you use our websites so we can make them better, e.g. They're used to gather information about the pages you visit and how many clicks you need to accomplish a task. PgAdmin Graphically Change postgres Admin Password posted Mar 25, 2012, 4:39 AM by Haris Hashim updated Mar 25, 2012, 8:14 AM. ? A CLI workflow for the administration of macOS applications distributed as binaries - Homebrew/homebrew-cask.
Install PostgreSQL via Homebrew
Likely most OS X users know of
Homebrew
, but Homebrew is a package manager for OS X that allows you to easily install and run a massive library of applications and utilities with ease.We won’t go through the entire (albeit short) installation process of Homebrew, but if you wish to install Homebrew and use it for PostgreSQL management, check out the installation command on the official documentation. If you aren’t sure if Homebrew is installed, try the
which brew
command from the terminal to verify.Once Homebrew is installed, you can install PostgreSQL by issuing the following commands in your terminal:
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.You should see a good deal of useful information in the output during installation, much of which should be copied down for use in the next sections.
Using a LaunchAgent and plist to Launch PostgreSQL on Startup
In most cases, you’ll likely wish to have PostgreSQL launch when you start up your system, so you’ll need to tell your computer this is your desire.
First, you’ll need to create a directory for your
LaunchAgents
to reside (if the directory doesn’t exist already). LaunchAgents
in OS X are simple scripts used by launchd
that cause the system to run programs or code during startup.Create your
user
-specific LaunchAgents
directory with this command, if necessary:Now you’ll need to create a symbolic link from the script that actually allows Postgres to run to the
LaunchAgents
directory. A symbolic link is similar to creating a new copy of a file for use in another directory, but since the link is ‘symbolic’, the link is just a forwarding address: any request made to that symbolic link location is actually “forwarded along” or redirected to where the real file actually resides.Link to the
plist
(property list) file that was generated by Homebrew and place that new symbolic link in LaunchAgents
with this command:Note: Double-check that the command is correct: It should’ve been part of the installation output mentioned above when Homebrew installed Postgres initially.
Finally, we load the new symbolic link’ed
LaunchAgent
file using the launchctl load
command, which is specifically what informs the computer to run this script and start Postgres when the computer launches. Again, the exact command to enter for your own installation will be an output during Homebrew’s Postgres installation, but it should look something like this:Manually Starting PostgreSQL
To manually startup Postgres without rebooting, again you should be able to use the command that was output during the installation, like so:
![Homebrew Homebrew](/uploads/1/1/9/5/119561264/266577670.png)
This will attempt to launch Postgres in
daemon
mode, which means it will be running as a background process without taking over your terminal.Pgadmin Homebrew Software
Start/Stop PostgreSQL Without Homebrew
In the event that you don’t have (or don’t wish to use) Homebrew for Postgres, yet you have Postgres installed already, you can also manually start it with
pg_ctl
Apache markdown. , which is the launch utility provided by Postgres itself.This will start Postgres (assuming default directories):
And this will stop Postgres:
Startup Troubleshooting: Did You Run initdb
?
Pgadmin Homebrew Game
In some cases, if you have trouble running Postgres, be sure you’ve executed the
initdb
command one time, which causes Postgres to initialize the database cluster for a new installation and allows you to connect with the default postgres
user.