Macos – Unable to get Postgresql commands to work in terminal

macospostgresql

After installing Postgresql by dragging folder into my applications folder I am unable to get commands to work in the terminal and unable to add the path so that is shows up using the command $ echo $PATH.

Postgres starts in the terminal using the elephant icon on the system tray and selecting "open psql" so I believe it installed correctly.

I tried adding all different combinations of the following lines to my .bash_profile

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

then

PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"

then

export PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin

and finally

export PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin

After each attempt I ran $ source $HOME/.bash_profile and then checked path and/or tried $psql $ which psql to no avail.

Also tried adding lines to .bashrc, .profile and .zshrc without luck.

The path to the executable commands bin folder in the app (psql, createdb, createlang, etc..) is

$ /Applications/Postgres93.app/Contents/MacOS/bin

Any help would be greatly appreciated!

running OSX 10.9.1
– posted question on stackoverflow but may be more appropriate here…??

adding my .bash_profile below—–

PS1="\u$ "
alias ll="ls -lahG"
alias finder="open `pwd`"
export PATH="/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PATH=/Applications/Postgres93.app/Contents/MacOS/bin:$PATH
export CLICOLOR=1
export LSCOLORS=HBfxcxdxbxegedabagacadexport PATH=/usr/local/bin:/Users/Jimmy/.rvm/gems/ruby-   2.0.0-p195/bin:/Users/Jimmy/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/Jimmy/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/Jimmy/.rvm/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Best Answer

There is an error on this line:

export LSCOLORS=HBfxcxdxbxegedabagacadexport PATH=/usr/local/bin:/Users/Jimmy/.rvm/gems/ruby-   2.0.0-p195/bin:/Users/Jimmy/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/Jimmy/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/Jimmy/.rvm/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

This will set both the LSCOLORS and PATH variables.

I think that the last part of this line is an error. Removing it should fix your problem.

By setting the PATH variable here it will remove the previous changes that you have made because you are explicitly setting the value without reference to $PATH.

The last export at the end of the export LSCOLORS=HBfxcxdxbxegedabagacadexport command should probably be removed too.

Related Question