

#Install and run postgresql mac ruby how to#
This tutorial will teach you how to set up, configure, and use PostgreSQL on MacOSX 10.7 (Lion) and above. If you’re here reading this tutorial, hopefully, you are trying to do the same! The other day I began a new Node.js project and wanted to use PostgreSQL as my database backend. Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -D /Library/Server/PostgreSQL/Data -c listen_addresses=127.0.0.1,::1 -c log_connections=on -c log_directory=/Library/Logs/PostgreSQL -c log_filename=PostgreSQL. To start: sudo serveradmin start postgres Tip: Do not start with defining $PGDATA and so on. That means that it is already configured, and you only need to launch it, and then create users and databases. PostgreSQL is integrated in Server.app available through the App Store in Mac OS X v10.8 (Mountain Lion). PostgreSQL was most likely installed via Homebrew, Fink, MacPorts or the EnterpriseDB installer.Ĭheck the output of the following commands to determine which package manager it was installed with: brew & brew list|grep postgres Make sure tcp localhost connections are enabled in pg_hba.conf: # IPv4 local connections:Ĭheck the listen_addresses and port in nf:Įgrep 'listen|port' /usr/local/var/postgres/nf #listen_addresses = 'localhost' # What IP address(es) to listen on What is the result of pg_ctl -D /usr/local/var/postgres status?Īre there any error messages in the server.log? What is the result of pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start? "To have launchd start postgresql now and restart at login:" Pg_ctl -D /usr/local/var/postgres stop Start automatically Pg_ctl -D /usr/local/var/postgres start Stop manually For more information, run brew info postgres. The Homebrew package manager includes launchctl plists to start automatically. I am still getting the same "Is the server running?" message. > cp /usr/share/postgresql/ /usr/share/postgresql/nf

So I tried this: > cp /usr/local/Cellar/postgresql/9.0.4/share/postgresql/ /usr/local/Cellar/postgresql/9.0.4/share/postgresql/nf #listen_addresses = 'localhost' # what IP address(es) to listen on So I did this: egrep 'listen|port' /usr/local/Cellar/postgresql/9.0.4/share/postgresql/ usr/local/Cellar/postgresql/9.0.4/share/postgresql/ Though, I did do this: >sudo find / -name "*nf*" This seems odd: > egrep 'listen|port' /usr/local/var/postgres/nfĮgrep: /usr/local/var/postgres/nf: No such file or directory Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.

#Install and run postgresql mac ruby update#
Update 5: sudo pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start > pg_ctl -D /usr/local/var/postgres status Here are the contents: # IPv4 local connections:īut I don't understand this: > pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start I found that there wasn't any pg_hba.conf file (only file pg_), so I modified the sample and renamed it (to remover the. Update 3: > pg_ctl -D /usr/local/var/postgres status Is the server running on host "localhost" and accepting The touch was not successful, so I did this instead: > mkdir /usr/local/var/postgresīut when I try to start the Ruby on Rails server, I still see this: Sh: /usr/local/var/postgres/server.log: No such file or directory Update: > pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start I see that postgres is not running > ps auxwww | grep postgres I had forgotten to run the initdb command.īy running this command ps auxwww | grep postgres
