poltdns.blogg.se

Brew install psql
Brew install psql









Notice that one of the values is a path to an error file (actually its the same file used for both standard out and standard error) - /usr/local/var/log/postgres.log. The output shows that it's an xml file: KeepAlive Label ProgramArguments /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres RunAtLoad StandardErrorPath /usr/local/var/log/postgres.log StandardOutPath /usr/local/var/log/postgres.log WorkingDirectory /usr/local

brew install psql

Let's take a look at the configuration for the postgresql service: cat ~/Library/LaunchAgents/ plist files contain service configuration information. The brew services list command can be used again, but this time, instead of showing none for postgresql, it shows an error status and path to a plist file (because of the earlier attempt to start it which failed): $ brew services list Name Status User File mysql started dbaron ~/Library/LaunchAgents/ postgresql error 256 dbaron ~/Library/LaunchAgents/ redis started dbaron ~/Library/LaunchAgents/ The output shows that the postgresql service is loaded, but not running: postgresql () Running: ✘ Loaded: ✓ Schedulable: ✘ Running it for postgresql: brew services info postgresql The info command can be used to get more detailed information about a specific service.

brew install psql

The -nP options indicate not to include host and port names in the Node Name column and +c 15 increases the command width display, which otherwise defaults to 9: lsof -nP +c 15 | grep LISTEN # no output for 5432 Unfortunately, the output of this command showed the database was not running: psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?Ī further check with lsof (list open files belonging to active processes) confirmed there was no process listening on port 5432, which is the default port used by postgresql. You can connect to the default postgres database as follows: psql -d postgres PostgreSQL comes with psql, a command line tool to interact with the database. The output of this command showed it was successful: => Successfully started `postgresql` (label: ) The Problemīut before pressing the easy button for finding such a quick fix, I wanted to check that a connection worked. So the fix should be simple enough, just start it with the start option of the services subcommand: brew services start postgresql My output showed I had mysql, postgresql, and redis as managed services, but that postgres wasn't started: mysql started dbaron ~/Library/LaunchAgents/ postgresql none redis started dbaron ~/Library/LaunchAgents/ To get information about services that are currently being managed by Homebrew, use the list option of the services subcommand: brew services list However, I couldn't remember whether the database server was running. For production projects, I prefer to setup all databases in Docker containers, but for a simple tutorial, it's fine to use a local service, which I had installed some time ago via brew install postgresql.

brew install psql

This all started when I wanted to follow along with a Rails tutorial that required scaffolding a new project with Postgresql as the database. A common usage of the services subcommand is to start and stop databases.

brew install psql

In addition to installing, you can also manage services using Homebrew's services subcommand, a wrapper for launchctl. If you work on a Mac, it's likely you use Homebrew to install packages.

#Brew install psql how to

This post will cover how to troubleshoot when the postgresql service installed via Homebrew on a Mac isn't starting.









Brew install psql