After su postgres
and typing of my password in my macOS terminal, it shows bash-3.2$
What when I type command like createdb
, it says:
bash: createdb: command not found
I googled and it says "either PostgreSQL was not installed at all or your shell's search path was not set to include it."
How can I fix this?
Before typing in su postgres
type in which createdb
which will tell you what the path is for createdb. For example if which returns /usr/local/bin/createdb
, you would add that path to your environmental variable $PATH
by typing export PATH=$PATH:/usr/local/bin
in the command line once you type su postgres
. Then you can run createdb.
Alternatively, you can just specify the full path in the command line /usr/local/bin/createdb
. If you need to do this often, you can add the line to change the PATH
variable in ~/.bash_profile
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With