我正在尝试在Mac OS X 10.6上安装PostgreSQL for Rails.首先我尝试了MacPorts安装,但是进展不顺利,所以我做了一键式DMG安装.这似乎有效.
我怀疑我需要安装PostgreSQL开发包,但我不知道如何在OS X上执行此操作.
这是我尝试做的事情sudo gem install pg:
$ sudo gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /Library/PostgreSQL/8.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client …Run Code Online (Sandbox Code Playgroud) $ sudo bundle install
Run Code Online (Sandbox Code Playgroud)
结果
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.4)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.11)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo …Run Code Online (Sandbox Code Playgroud) 我试图捆绑安装,但是,由于一些奇怪的原因,pg gem在安装时返回以下错误:
$ gem install pg -v '0.18.4'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151221-23315-1tkv3fd.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 …Run Code Online (Sandbox Code Playgroud) 我最近尝试将我的轨道3.2*应用程序升级到rails 4.2.*.但是,我在安装'pg'宝石时被拦住了.当我用Google搜索时,解决方案主要与OSX相关.但我正在使用ubuntu 14.04.需要针对以下问题提出任何建议.
我postgresql 9.3.5在我的机器上安装了版本.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/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
--without-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=. …Run Code Online (Sandbox Code Playgroud) 我试图将我的rails应用程序推送到heroku并收到如下错误:
-
Counting objects: 177, done. Delta compression using up to 2 threads.
Compressing objects: 100% (161/161), done. Writing objects: 100%
(177/177), 44.73 KiB, done. Total 177 (delta 39), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.1
Running: bundle install --without development:test --path vendor/bundle -
-binstubs bin/
Fetching gem metadata from
Fetching gem metadata from
Installing rake (10.0.2)
Installing i18n (0.6.1)
Installing multi_json (1.3.7)
Installing activesupport (3.2.8)
Installing builder …Run Code Online (Sandbox Code Playgroud) 这是尝试时的错误 bundle install
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 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. …Run Code Online (Sandbox Code Playgroud) 我试图让Ruby版本2.0.0-p353在CentOS 6.5上的Nginx 1.4.7上运行.一切都按预期安装,但当我到达运行点时,bundle install我收到以下错误:
Gem :: Ext :: BuildError:错误:无法构建gem原生扩展.
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby 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
--without-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 …Run Code Online (Sandbox Code Playgroud) 在我的ubuntu系统上安装PostgreSQL,当我尝试运行bundle install时,我收到以下错误.
有没有办法运行命令并安装所有必要的宝石
-- gem install pg -v '0.18.4'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/mink7/.gem/ruby/2.3.0/gems/pg-0.18.4/ext
/home/mink7/usr/local/2.3.0/bin/ruby -r ./siteconf20160408-15866-1siay0w.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. …Run Code Online (Sandbox Code Playgroud) 我正在关注Michael Hartl Ruby on Rails 教程,并且有一部分是他指示您更新 Gemfile 以包括:
group :production do
gem 'pg', '0.12.2'
end
Run Code Online (Sandbox Code Playgroud)
然后在终端中输入以下命令:
bundle update
bundle install --without production
Run Code Online (Sandbox Code Playgroud)
当您运行 bundle update 命令时,它会抛出以下错误。
sample_app:$ bundle update
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.3)
Using i18n (0.6.4)
etc
[omitted lines for brevity]
etc
Using railties (3.2.12)
Using coffee-rails (3.2.2)
Installing diff-lcs (1.1.3)
Using jquery-rails (2.0.2)
Installing pg (0.12.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/ross/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb …Run Code Online (Sandbox Code Playgroud) 我很难尝试宝石安装pg -v'0.18.4',这是我的ruby on rails"捆绑安装"应用程序所需要的,该应用程序是在3年前开发的.
sudo gem install pg -v'0.18.4'
它抱怨如下:
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
extern void PQconnectdb();
Run Code Online (Sandbox Code Playgroud)
完整执行错误https://gist.github.com/axilaris/f521685f4e5c7a8e5653bf672af1efa7
mkmf.log - https://gist.github.com/axilaris/2e4cf2729b34d751c1ce76b046a0b21c
我的环境如下:
Postgres 9.4.0.1
MacOs Sierra High 10.13.1
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
$ rails -v
Rails 5.1.4
Run Code Online (Sandbox Code Playgroud)
我试图安装brew install libpqxx它不起作用
以下是一些相关的stackoverflow:
我想确保安装 - sudo gem install pg -v'0.18.4'.从生产开始,它也应该运行.我不想破坏生产ubuntu服务器中运行的任何东西.目前针对这个问题,我正在我的mac上设置环境以进行开发,以尝试进行代码修复.
仅供参考,我试过2个mac.一个升级到sierra high的原始开发mac,另一个是新安装的sierra high的新格式化mac.
On R, I was trying to install the PostgreSQL package called the RPostgreSQL.
I tried to install it by issuing the statement in the command-line like so:
R
Run Code Online (Sandbox Code Playgroud)
命令行语句显示输出:
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but …Run Code Online (Sandbox Code Playgroud) 编辑
对我有用的是运行:
brew doctor
Run Code Online (Sandbox Code Playgroud)
然后我不得不 chown 一些文件并删除它要求我删除的一些内容。
然后我跑了
sudo gem install pg
Run Code Online (Sandbox Code Playgroud)
它起作用了。不知道为什么它只适用于“sudo”,但是当我之前尝试过但没有失败
我使用捆绑器安装了一堆 gem(大多数都失败了,我花了几个小时浏览互联网帖子以了解如何安装特定的 gem。
目前正在运行
bundle install
Run Code Online (Sandbox Code Playgroud)
投诉以下内容
jacks-MacBook-Pro:techendo jsw$ bundle install
Fetching source index from https://rubygems.org/
Using rake 10.3.2
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.39
Using activesupport 4.0.3
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.3
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.3 …Run Code Online (Sandbox Code Playgroud) postgresql ×7
rubygems ×5
ruby ×4
pg ×3
sqlite ×2
bundle ×1
bundler ×1
centos ×1
deployment ×1
heroku ×1
linux ×1
macos ×1
r ×1
ubuntu ×1
ubuntu-12.04 ×1