Ubuntu/Debian:
sudo apt-get install libpq-dev
CentOS/Fedora/RHEL:
sudo yum install postgresql-devel
macOS:
brew install postgresql
gem install pg -v '1.2.3' -- --with-pg-config=/path/to/pg_config
其中,/path/to/pg_config 是 PostgreSQL 的二进制文件目录,可以使用以下命令查找:
which pg_config
gem install pg -v '1.2.3' -- --with-pg-config=/usr/local/Cellar/postgresql//bin/pg_config
其中,
brew info postgresql