How to Install Specific Version of Postgres SQL on MAC OS ?

How to Install Specific Version of Postgres SQL on MAC OS ?

Added commands and log while installing postgresql 9.5 on MacOS

 

 

eSumit@Sumits-MacBook-Pro:~$ brew search postgres
==> Searching local taps...
check_postgres postgresql postgresql@9.5 postgrest
postgres-xc postgresql@9.4 postgresql@9.6
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ brew install postgres@9.5
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
pushpin

Error: No available formula with the name "postgres@9.5" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
 git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ brew install postgresql@9.5
==> Downloading https://homebrew.bintray.com/bottles/postgresql@9.5-9.5.10.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring postgresql@9.5-9.5.10.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/postgresql@9.5/9.5.10/bin/initdb /usr/local/var/postgresql@9.5
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
 https://github.com/Homebrew/legacy-homebrew/issues/2510

To migrate existing data from a previous major version (pre-9.0) of PostgreSQL, see:
 https://www.postgresql.org/docs/9.5/static/upgrading.html

To migrate existing data from a previous minor version (9.0-9.4) of PostgreSQL, see:
 https://www.postgresql.org/docs/9.5/static/pgupgrade.html

You will need your previous PostgreSQL installation from brew to perform `pg_upgrade`.
 Do not run `brew cleanup postgresql@9.5` until you have performed the migration.

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
 echo 'export PATH="/usr/local/opt/postgresql@9.5/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
 LDFLAGS: -L/usr/local/opt/postgresql@9.5/lib
 CPPFLAGS: -I/usr/local/opt/postgresql@9.5/include
For pkg-config to find this software you may need to set:
 PKG_CONFIG_PATH: /usr/local/opt/postgresql@9.5/lib/pkgconfig


To have launchd start postgresql@9.5 now and restart at login:
 brew services start postgresql@9.5
Or, if you don't want/need a background service you can just run:
 pg_ctl -D /usr/local/var/postgresql@9.5 start
==> Summary
🍺 /usr/local/Cellar/postgresql@9.5/9.5.10: 3,180 files, 35.4MB
eSumit@Sumits-MacBook-Pro:~$ postgres -version
-bash: postgres: command not found
eSumit@Sumits-MacBook-Pro:~$ postgresql -version
-bash: postgresql: command not found
eSumit@Sumits-MacBook-Pro:~$ postgresql 
-bash: postgresql: command not found
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ 
eSumit@Sumits-MacBook-Pro:~$ echo 'export PATH="/usr/local/opt/postgresql@9.5/bin:$PATH"' >> ~/.bash_profile
eSumit@Sumits-MacBook-Pro:~$ psql --version
-bash: psql: command not found
eSumit@Sumits-MacBook-Pro:~$

 

 

eSumit@Sumits-MacBook-Pro:~$ psql –version
psql (PostgreSQL) 9.5.10
eSumit@Sumits-MacBook-Pro:~$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s