This installation process is from MONCEF BELYAMANI
Have you tried: brew services start postgresql? – Chessbrain Jul 16 '19 at 14:02 By logs provided by you i think you have delete pgtblspc and pgreplslot directory from data-diectory of postgresql 11.4 kindly put back those if you can't recover just create it using mkdir pgtblspc with postgres user permission and start again – Ashiq. Starting Services Let’s go ahead and start Postgres running, and make sure Postgres starts every time your computer starts up. Execute the following command: pgctl -D /usr/local/var/postgres start && brew services start postgresql. Get PostgreSQL (psql) by running brew install postgresql on your Terminal. Downloading and installing may take some time because homebrew will also take care of the dependencies needed. Now execute the brew services start postgresql command to start the Postgres service on the Mac machine. Install Postgres on Ubuntu. For a Linux machine, execute the following command in the terminal to install PostgreSQL on Ubuntu 18.
Brew services start postgresql@9.6 is successful also Successfully started postgresql@9.6 (label: homebrew.mxcl.postgresql@9.6) But when I tried to access Postgres from my Mac terminal psql postgresql@9.6 it prompt me weird error.
This is a quick guide for installing PostgreSQL (Postgres
for short) on a Mac with Homebrew, and starting and stopping it with Lunchy. If you've just forked a Ruby on Rails project that requires Postgres, this tutorial will get you up and running in no time.
If you're working on a brand new Rails app and need to create a new Postgres user and database for your app, I recommend Will Jessop's tutorial or Peter Cooper's screencast.
Step 1: Install Homebrew
To make sure you have all the tools necessary for Ruby on Rails development, I recommend you follow my tutorial for installing Xcode, Homebrew, Git, RVM, and Ruby on a Mac.
Step 2: Update Homebrew
Before you install anything with Homebrew, you should always make sure it's up to date and that it's healthy:
Step 3: Install Postgres
When you install Postgres, you will see a bunch of output in your Terminal that looks like this:
The important sections are Build Notes
, Create/Upgrade a Database
, and Start/Stop PostgreSQL
. Make sure to follow those instructions to the letter.
Step 4: Create/Upgrade a database
If this is your first time installing Postgres with Homebrew, you'll need to create a database with:
I copied and pasted that command directly from the Terminal output. You should do the same, in case the instructions change in the future.
Step 5: Install Lunchy
Lunchy is a helpful gem that will allow you to easily start and stop Postgres.
Step 6: Start/Stop Postgres
Once again, I'm copying and pasting the following commands from my Terminal. Note that the second command is specific to the version of Postgres that was installed on my machine. If the version number has changed since I've written this tutorial, using the command below won't work for you, so you should make sure to copy the command from your Terminal output.
Since we're using Lunchy, we don't need to run this third command:
Instead, we'll simply use this to start Postgres:
At this point, you should be all set to run the rake
commands to create and use the database for the existing Rails app you're working on.
To stop Postgres:
Homebrew is a package manager for Mac OS X that builds software from its source code. It includes a version of PostgreSQL packaged by what it refers to as a formula. This type of installation might be preferred by people who are comfortable using the command line to install programs, such as software developers.
Typical use looks like
This install the command line console (psql) as well as the server, if you'd like to create your own databases locally.Run the following to start the server and login to it (it basically sets up a single 'admin' user with your username, so that's who you'll be logged in as.
You can see what other versions are available by running
You can see which version the current latest will be by running
Notes on Homebrew:
- Brew Install Postgresql on OS X Lion - Resolving conflicts with the built-in PostgreSQL libraries shipping with OS X 10.7 'Lion'
petere/postgresql
tap for installing multiple PostgreSQL versions in parallel