首页 文章

安装Gem Error - 无法构建gem原生扩展

提问于
浏览
0

我继承了Ruby on Rails项目 . 它是全部压缩的,所以作为第一步,我想让它在我的桌面Mac上运行:

脚本/服务器

=>启动WEBrick ... /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:74:in establish_connection': Please install the postgresql adapter: gem install activerecord-postgresql-adapter`(no这样的文件要加载 - pg)(RuntimeError)

所以,我尝试安装activerecord-postgresql-adapter gem然后得到这个:

$ sudo  gem install activerecord-postgresql-adapter
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing activerecord-postgresql-adapter:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb在/System/Library/Frameworks/Ruby.framework/Versions/1.8/找不到ruby的头文件usr / lib中/红宝石/ ruby.h

Gem文件将保留在/Library/Ruby/Gems/1.8/gems/pg-0.14.1中以供检查 . 结果记录到/Library/Ruby/Gems/1.8/gems/pg-0.14.1/ext/gem_make.out

我怎样才能安装这个必需的宝石?

谢谢

1 回答

  • 2

    假设您熟悉rails并正确安装它,您需要使用macports来安装postgre的驱动程序,然后才能使用任何gem .

    有说明here,或(更近期,使用brew)here

相关问题