pgenv is a tiny tool that helps install various versions of PostgreSQL on bash.
git clone https://github.com/moritoru81/pgenv.git
source pgenv/install.sh
or
git clone https://github.com/moritoru81/pgenv.git
cat <<EOS >> ~/.bash_profile
### start pgenv
source `pwd`/pgenv/profile
export PATH=`pwd`/pgenv/bin:\$PATH
### end pgenv
EOS
touch `pwd`/pgenv/profile
source ~/.bash_profile
pgenv install --g3 9.6.3
pgenv shell 9.6.3 # exec $SHELL
pgenv global 9.6.3
psql -V
pgenv diff 9.5.6:9.6.3:src/backend/parser/analyze.c | less -R
# @ is current version
pgenv diff 9.5.6:@:src/backend/parser/analyze.c | less -R
EDITOR=vim pgenv edit @:src/backend/parser/analyze.c
pgenv grep @:src/backend/parser:'_hook'
pgenv directories
pgenv select
# Show prefix
pgenv prefix # => /path/to/versions/current_version
pgenv prefix 9.5.1 # => /path/to/versions/9.5.1
# Create a database cluster with version 9.5.1
$(pgenv prefix 9.5.1)/bin/initdb db95
By default, pgenv uses file 'configure_default_options'. But also you can use definitions for the specified version.
# If the option file for the specified version, it's used.
configure_default_options-9.6.3
# Otherwise, the default option file.
configure_default_options