PostgreSQL - pg_config -bash: pg_config: command not found
50,221
Solution 1
you can install postgresql-devel to get that. in rpm based distro
yum install postgresql-devel
will work
or use
yum provides "*/pg_config"
to get the exact package
Solution 2
In addition to installing postgresql-devel
I had to modify the PATH
environment variable. E.g. add this to your .bashrc
:
export PATH="$PATH:/usr/pgsql-9.4/bin"
Solution 3
My problem was that pg_config
was not in the PATH. So, I first needed to search for pg_config
's path by using
yum provides "*/pg_config"
After noting the path, I used this command to install pg gem
gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config
That installed pg
successfully. The system was a CentOS.
Author by
AnApprentice
working on Matter, a new way to gather professional feedback.
Updated on April 18, 2021Comments
-
AnApprentice about 3 years
I'm on a Mac building an app in Rails 3 with PostgreSQL...
PostgreSQL is working fine but in the command line I get the following error:
$ pg_config -bash: pg_config: command not found
Anyone know how to get this setup so I can run pg_config?
Thanks
-
Walt W over 12 yearsFor those who find this answer, this program is now part of the package
libpq-dev
-
tflutre over 12 yearson Ubuntu: sudo apt-get install libpq-dev
-
MattSayar almost 12 yearsFor those who find this answer, I still found this program in
postgresql-devel
in the CentOS Updates repo with CentOS 5.5 -
chirale about 11 yearsFind it finally, thank you. I'm on CentOS and after yum provides I run:
python26 setup.py install build_ext --pg-config /usr/pgsql-9.2/bin/pg_config
to run on python 2.6 / postgre 9.2 -
amoyer almost 8 yearsConfirmed with Fedora 24:
dnf install postgresql-devel
gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config