Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL - pg_config -bash: pg_config: command not found

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

like image 886
AnApprentice Avatar asked Nov 27 '10 18:11

AnApprentice


People also ask

What is Pg_config?

The view pg_config describes the compile-time configuration parameters of the currently installed version of PostgreSQL. It is intended, for example, to be used by software packages that want to interface to PostgreSQL to facilitate finding the required header files and libraries.

Where is PG Config windows?

Open the postgresql. conf configuration file. This file is located at %postgresql_dir%\data . Here %postgresql_dir% (for example, C:\Program Files\PostgreSQL\11 ) is the folder that PostgreSQL was installed in.


3 Answers

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"
like image 21
dimid Avatar answered Oct 09 '22 16:10

dimid


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

like image 90
Unni Avatar answered Oct 09 '22 18:10

Unni


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.

like image 4
Anwar Avatar answered Oct 09 '22 16:10

Anwar