我正在尝试在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) 我安装OS X Yosemite,现在我的gcc 4.9.1编译器存在很大问题.我希望有人可以帮助我.
我尝试编译我的程序,我有警告消息:
gcc: warning: couldn’t understand kern.osversion ‘14.0.0'
Run Code Online (Sandbox Code Playgroud)
我搜索谷歌,我发现https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407 我尝试应用补丁:
sudo patch -p1 < /usr/local/bin/00-darwin-10.10.patch
Run Code Online (Sandbox Code Playgroud)
在gcc文件夹中:/usr/local/bin/gcc
我收到了以下消息:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
|index dd45802..0db14d7 100644
|--- a/fixincludes/fixincl.x
|+++ b/fixincludes/fixincl.x
--------------------------
File to patch:
Run Code Online (Sandbox Code Playgroud)
在File to patch:我已经尝试过gcc,我收到了消息:
patching file gcc
Hunk #1 FAILED at 1.
Hunk #2 FAILED at …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用PostgreSQL,以便我可以部署到Heroku.但是我不能再运行localhost了么?我收到以下消息:
PG::ConnectionBad
FATAL: role "Myname" does not exist
Run Code Online (Sandbox Code Playgroud)
这是我的databse.yml
development:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
test:
adapter: postgresql
database: my_database_test
pool: 5
timeout: 5000
production:
adapter: postgresql
database: my_database_production
pool: 5
timeout: 5000
Run Code Online (Sandbox Code Playgroud)
这是我的gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
# Use pg as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem …Run Code Online (Sandbox Code Playgroud) 我更新了包含pg gem的bundler,我收到了错误
An error occured while installing pg (0.14.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.0'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我在rubygems.org上检查了这个gem ,今天(6月23日)发布了这个版本.我不知道为什么,但版本不能正常工作并返回上面的错误.
解决方案是设置特定版本 - 在这种情况下
宝石"pg","〜> 0.13.2"
有同样问题的人吗?
我正在尝试将我的 rails 应用程序安装到 Heroku,但是在尝试安装 pg gem 时遇到了问题。我被告知将 Gemfile 中的“gem 'sqlite3'”行替换为以下内容:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_stdout_logging'
end
Run Code Online (Sandbox Code Playgroud)
然后执行捆绑安装。我收到此错误消息:
...
Using coffee-rails (3.2.2)
Using jquery-rails (3.0.4)
Installing pg (0.17.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes …Run Code Online (Sandbox Code Playgroud) postgresql ×3
pg ×2
c ×1
c++ ×1
gcc ×1
gem ×1
heroku ×1
localhost ×1
osx-yosemite ×1
rubygems ×1