Ruby on rails 用Mavericks在我的mac上安装PG gem是不可能的
我正在尝试安装pggem,以便再次使用我的rails项目。但我得到了这个错误: 构建本机扩展。这可能需要一段时间。。。错误:错误 安装pg:错误:无法生成gem本机扩展Ruby on rails 用Mavericks在我的mac上安装PG gem是不可能的,ruby-on-rails,postgresql,gem,osx-mavericks,Ruby On Rails,Postgresql,Gem,Osx Mavericks,我正在尝试安装pggem,以便再次使用我的rails项目。但我得到了这个错误: 构建本机扩展。这可能需要一段时间。。。错误:错误 安装pg:错误:无法生成gem本机扩展 /Users/jeanosorio/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If 生成失败,请使用重试 --使用pg config=/path/to/p
/Users/jeanosorio/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If
生成失败,请使用重试
--使用pg config=/path/to/pg_config检查libpq fe.h。。。否找不到“libpq fe.h头”
*extconf.rb失败*由于某种原因无法创建Makefile,可能是缺少必要的库和/或头。检查
有关详细信息,请参阅mkmf.log文件。您可能需要配置
选项
提供的配置选项:--带opt dir--不带opt dir
--带opt include——不带opt include=${opt dir}/include
--带opt lib——不带opt lib=${opt dir}/lib——带make prog
--没有make prog--srcdir=--当前目录
--ruby=/Users/jeanosorio/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--有pg——无pg——有pg配置——无pg配置
--带-pg_配置--不带-pg_配置--带pg dir
--不带pg dir——带pg include
--不带pg include=${pg dir}/include--带pg lib
--不带pg lib=${pg dir}/
Gem文件仍将安装在中
/Users/jeanosorio/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/pg-0.17.0
供检查。结果记录到
/Users/jeanosorio/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/pg-0.17.0/ext/gem\u make.out
我尝试了在stackoverflow上找到的所有内容,但仍然出现此错误
如果我尝试使用brew安装postgresql,我会得到以下警告:
警告:postgresql-9.2.4已经安装,只是没有链接
如果我尝试链接
brew链接postgresql链接/usr/local/ceral/postgresql/9.2.4。。。
警告:无法链接postgresql。解除链接
错误:无法符号链接文件:
/usr/local/ceral/postgresql/9.2.4/share/man/man7/WITH.7
/usr/local/share/man/man7不可写。你应该改变它的颜色
权限
请帮忙
注意:我已经为mavericks安装了命令行工具
如果使用自制软件卸载并再次尝试安装,则会出现以下错误: ==>下载 ################################################################## 100.0% ==>修补文件src/pl/plpython/Makefile修补文件contrib/uuid ossp/uuid ossp.c ==>。/configure--prefix=/usr/local/ceral/postgresql/9.2.4--datadir=/usr/local/ceral/postgresql/9.2.4/share/postgresql--docdir=/usr/local/ceral/p ==>创建安装世界 ==>注意事项 构建注释 如果PostgreSQL 9的构建失败,而您的版本为8.x 如果已安装,则可能需要先删除以前的版本。请参阅:
创建/升级数据库 如果这是您的第一次安装,请使用:initdb创建一个数据库 /usr/local/var/postgres-E utf8 从以前的主要版本(9.2之前)迁移现有数据 PostgreSQL,请参阅:
加载扩展 默认情况下,自制将生成所有可用的Contrib扩展。看电影 从psql命令行运行所有可用扩展的列表:
从pg_可用_扩展中选择* 要加载任何扩展名,请导航到所需的数据库 并运行:创建扩展名[扩展名] 例如,要在当前数据库中加载tablefunc扩展, 运行:创建扩展tablefunc 有关“创建扩展名”命令的详细信息,请参阅:
对于 有关扩展的更多信息,请参阅:
其他 某些计算机可能需要提供共享内存:
安装postgres gem时,建议包括ARCHFLAGS: ARCHFLAGS=“-arch x86_64”gem安装页面 要在没有sudo的情况下安装gems,请参阅自制wiki 要在登录时启动postgresql,请执行以下操作: ln-sfv/usr/local/opt/postgresql/*.plist~/Library/LaunchAgents然后立即加载postgresql: launchctl load~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist,或者,如果您没有 想要/需要启动CTL,您只需运行: pg_ctl-D/usr/local/var/postgres-l/usr/local/var/postgres/server.log启动警告:无法链接 postgresql。解除链接。。。错误:
brew链接
步骤未完成
已成功生成公式,但未符号链接到/usr/local
您可以使用“brew链接postgresql”重试
==>Summary在我的例子中(我需要在Mavericks上使用PG0.16.0),我通过
然后
gem install pg -v '0.16.0' -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
对于最新版本,您需要扣除-v“0.16.0”
gem install pg -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
如果您安装了自制软件,请先不要安装MacPorts,因为我无法通过MacPorts安装postgres。相反,我安装了。打电话
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
注意:在较新的版本(至少在9.3中)中,路径实际上是:
/Applications/Postgres.app/Contents/versions/9.3/bin/pg_config
如果要避免使用MacPorts,可以下载并将其放入应用程序目录中
然后,指定新下载的pg_config
的位置:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
如果遇到缺少标题的问题,请尝试指定应用程序的include
目录:
gem install pg -- --with-pg-include='/Applications/Postgres.app/Contents/Versions/latest/include/'
如果您想直接使用postgresql安装程序,这里还有另一种选择。在升级到小牛队之后,你首先要做的就是跳出几圈。以下是我所做的: 首先安装xcode命令行工具:
xcode-select --install
下载并安装最新版本的PostgreSQL(9.3.1),就我而言,我只是使用了图形安装程序。以下是下载页面的链接:
http://www.enterprisedb.com/products-services-training/pgdownload#osx
只需选择它提供给您的所有默认值。在我的情况下,它将postgres安装到以下目录,如果您将其安装到其他目录,请记住您选择的路径,因为您很快就会需要它
/Library/PostgreSQL/9.3
如果你
/Library/PostgreSQL/9.3
ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
sudo ln -s /Library/PostgreSQL/9.3/lib/libpq.5.dylib /usr/local/lib/libpq.5.dylib
---
BUNDLE_BUILD__PG: --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
BUNDLE_BUILD__EXAMPLE_GEM: --other-configs
BUNDLE_BUILD__OTHER_EXAMPLE_GEM: --other-configs
gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
gem install pg -- --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
brew install postgresql
$ ls /usr/local/Cellar/postgresql/9.3.3/bin/pg_config
> /usr/local/Cellar/postgresql/9.3.3/bin/pg_config
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.3/bin/pg_config
brew install postgres
bundle install
which psql
/usr/local/bin/psql
bundle config build.pg --with-pg-config=/usr/local/bin/pg_config
brew update
brew install postgresql
gem install pg -v '0.17.1'
env ARCHFLAGS="-arch x86_64" gem install pg -- \
--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
env ARCHFLAGS="-arch x86_64" gem install pg -v '0.17.1' -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
brew install postgresql
sudo env ARCHFLAGS="-arch x86_64" gem install pg
gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/Versions/9.4/bin/pg_config
sudo su
ARCHFLAGS="-arch x86_64" gem install pg -v '0.18'
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- \--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
sudo find / -name "pg_config" -print
brew cask install postgres
echo 'export PG_HOME=/Applications/Postgres.app/Contents/Versions/latest' >> ~/.bash_profile
echo 'export PATH="$PATH:$PG_HOME/bin"' >> ~/.bash_profile
source ~/.bash_profile
# now it just works
gem install pg
which postgres
/usr/local/opt/postgresql@12/bin/postgres
gem install pg -- --with-pg-config=/usr/local/opt/postgresql@12/bin/pg_config