gem install pg -v '0.18.2'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension. current directory: /Users/bevan/.rvm/gems/ruby-2.3.0/gems/pg-0.18.2/ext
/Users/bevan/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160226-49308-30rbgs.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options. Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/bevan/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/bevan/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/bevan/.rvm/gems/ruby-2.3.0/gems/pg-0.18.2 for inspection.
Results logged to /Users/bevan/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.2/gem_make.out

当出现如上的错误的时候,解决方法如下

ubuntu:

1.  sudo apt-get install libpq-dev

2.  gem install pg

mac:

1. brew install postgresql
2. gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

ruby on rails gem install pg时无法安装的更多相关文章

  1. 在执行gem install redis时 : ERROR: Error installing redis: redis requires Ruby version >= 2.2.2

    在执行gem install redis时 提示: gem install redis ERROR: Error installing redis: redis requires Ruby versi ...

  2. ruby on rails 在centos 7下的安装配置

    因为想安装最新版本,所以通过编译安装. 安装前准备工具和库文件: sudo yum install gcc gcc-c++ openssl-devel readline-devel gdbm-deve ...

  3. Ubuntu 16.04在搭建Redis Cluster搭建时,使用gem install redis时出现:ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.3.0 directory.

    注意:千万不要使用sudo来执行gem install redis. 解决方法: sudo apt-get update sudo apt-get install git-core curl zlib ...

  4. Install Ruby on Rails on Ubuntu 12.04 LTS

    1:Update package repository. sudo apt-get update 2:Install git and Curl.     Git:是一个简单,快速,高效的版本控制系统. ...

  5. Can't find the 'libpq-fe.h header when trying to install pg gem

    https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-p ...

  6. Ubuntu配置Ruby和Rails

    安装curl sudo apt-get install curl 安装RVM curl -L https://get.rvm.io | bash -s stable 通过RVM来安装Ruby rvm ...

  7. Windows下: RubyMine + Ruby On Rails + mysql 搭建开发环境

    最近在接手一个手机项目.在搭建环境的过程中,遇到了一些问题,在下文中已做记录,并奉上个人的解决方案. 开发环境 win2003 ;  JetBrains RubyMine6.3.3 1.  下载最新版 ...

  8. ruby on rails 实战(一)

    通过ruby on rails 一步一步搭建个人站点,涉及到的技术有:ruby,rails,javascript,jquery 操作系统:win7 IDE: rubymine 5.4. 第一步,下载安 ...

  9. Ruby on Rails Tutorial读书笔记-1

    只是怕忘了命令,全部撸一次,记个大概.. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 安装Ruby之前,先要安装RVM: curl -L https://get.rvm.io | bas ...

随机推荐

  1. 使用RDCMan管理SharePoint虚拟机的重复要求验证的问题

    首先,这个软件可以从这里下载: Remote Desktop Connection Manager 同类型的软件还有很多,我没有很多复杂功能的要求,就选择了这款微软官方的,虽然很久都没有更新过了. 为 ...

  2. 据说是百度ios面试题

    百度面试题:   一面:知识点 Objective C runtime library: Objective C的对象模型,Block的底层实现结构,消息发送,消息转发,内存管理 CoreData : ...

  3. java实现栈和队列

    class Node { int val; Node next; Node(int x) { val = x; next = null; } } class Stack { Node top; pub ...

  4. iOSQuartz2D-03-定制个性头像

    效果图 将一张图片剪切成圆形 在图片周围显示指定宽度和颜色的边框 实现思路 效果图中主要由不同尺寸的两大部分组成 蓝色的背景区域,尺寸等于图片的尺寸加上边框的尺寸 图片区域,尺寸等于图片的尺寸 绘制一 ...

  5. iOS之github第三方框架(持续更新)

    1.MBProgressHUD MBProgressHUD是一个开源项目,实现了很多种样式的提示框 使用上简单.方便,并且可以对显示的内容进行自定义,功能很强大,很多项目中都有使用到. 到Github ...

  6. Windows 7 与 Vmware Ubuntu 15.10_64 共享文件夹

    设置共享文件夹     安装/更新最新的vmware-tools   安装             在ubuntu 内部会打开DVD ,里面的压缩包中包含vmware-toole. 先解压      ...

  7. Hibernate案例-------基于xml配置,使用Hibernate实现对员工表的增、删、改、查功能

    1.1 问题 使用Hibernate实现对员工表的增.删.改.查. 1.2 方案 Hibernate使用步骤: 导入Hibernate包,以及数据库驱动包. 引入Hibernate主配置文件hiber ...

  8. android SQLiteOpenHelper使用示例

    我们大家都知道Android平台提供给我们一个数据库辅助类来创建或打开数据库,这个辅助类继承自SQLiteOpenHelper类,在该类的 构造器中,调用Context中的方法创建并打开一个指定名称的 ...

  9. nyoj 237 游戏高手的烦恼 二分匹配--最小点覆盖

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=237 二分匹配--最小点覆盖模板题 Tips:用邻接矩阵超时,用数组模拟邻接表WA,暂时只 ...

  10. Web Storage API : LocalStroage

    这是一篇详细介绍详细介绍详细介绍_(:з」∠)_ 背景: 当你访问一个页面,并不是丢到服务器,等待用户访问就可以了的.从输入网址到显示网页的全过程,可以参考这里 简单来说,在输入url按下回车键后,首 ...