Chef-Solo "undefined method `[]' for nil:NilClass" - centos

I just installed a fresh CentOS 6.3 VM and disabled SELinux. Below is the exact script that I ran to install Ruby, Chef Solo, and attempted to provision the VM:
#!/bin/bash
#
# Install Chef-Solo if it doesn't exist, then provision the server.
#
CHEF_FILE="https://dl.dropbox.com/u/4204671/LiquidCompass/lc-chef.tar.gz"
if [ "$#" -eq 0 ]; then
echo "You must provide the type of server this is. (Eg: production-api, qa-api, development)"
exit 1
fi
if [ ! -x "/usr/bin/chef-solo" ]; then
rpm -Uvh http://rbel.frameos.org/rbel6
yum install -y ruby ruby-devel ruby-ri ruby-rdoc ruby-shadow gcc gcc-c++ automake autoconf make curl dmidecode
cd /tmp
curl -O http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar zxf rubygems-1.8.10.tgz
cd rubygems-1.8.10
ruby setup.rb --no-format-executable
gem install chef --no-ri --no-rdoc
fi
if [ -d "/etc/chef" ]; then
rm -rf /etc/chef
fi
if [ -d "/tmp/lc-chef" ]; then
rm -rf /tmp/lc-chef*
fi
mkdir /etc/chef
echo "file_cache_path \"/tmp/lc-chef/chef-solo\"
cookbook_path \"/tmp/lc-chef/cookbooks\"
role_path \"/tmp/lc-chef/roles\"
json_attribs \"/etc/chef/node.json\"" > /etc/chef/solo.rb
echo "{
\"name\": \"$1\",
\"normal\": {
\"company\": \"Liquid Compass LLC\",
\"tags\": []
},
\"chef_environment\": \"_default\",
\"run_list\": [
\"role[$1]\"
]
}" > /etc/chef/node.json
cd /tmp
curl -O $CHEF_FILE
tar zxf lc-chef.tar.gz
chef-solo -c /etc/chef/solo.rb
Unfortunately, right as the script runs I receive:
[2012-12-05T17:39:27-07:00] INFO: Start handlers complete.
================================================================================
Recipe Compile Error in /tmp/lc-chef/cookbooks/liquidcompass/recipes/php.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/lc-chef/cookbooks/liquidcompass/recipes/php.rb:20:in `from_file'
Relevant File Content:
----------------------
/tmp/lc-chef/cookbooks/liquidcompass/recipes/php.rb:
13: # Unless required by applicable law or agreed to in writing, software
14: # distributed under the License is distributed on an "AS IS" BASIS,
15: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: # See the License for the specific language governing permissions and
17: # limitations under the License.
18: #
19:
20>> php_url = "http://us.php.net/distributions/php-#{node['php']['version']}.tar.gz"
21: node.set['php']['prefix'] = "/opt/php-#{node['php']['version']}"
22: node.set['php']['conf_path'] = "#{node['php']['dir']}/php.ini"
23: node.set['php']['configure_flags'] = [
24: "--prefix=#{node['php']['prefix']}",
25: "--with-config-file-path=#{node['php']['dir']}",
26: "--with-config-file-scan-dir=#{node['php']['dir']}/conf.d",
27: "--with-curl",
28: "--with-pear",
29: "--with-gd",
So it looks like it's choking on trying to load node['php']['version']. This is defined in my /tmp/lc-chef/cookbooks/liquidcompass/attributes/default.rb with:
default['php']['version'] = "5.4.9"
So it appears that Chef is either not loading the attributes file, or something else is wrong. Not exactly sure how to find this out or not.
Running:
RubyGems 1.8.10
Chef 10.16.2
Best regards,
Andrew
By the way, this is the stack trace:
Generated at Wed Dec 05 17:39:27 -0700 2012
NoMethodError: undefined method `[]' for nil:NilClass
/tmp/lc-chef/cookbooks/liquidcompass/recipes/php.rb:20:in `from_file'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/cookbook_version.rb:558:in `load_recipe'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/mixin/language_include_recipe.rb:33:in `include_recipe'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/run_context.rb:79:in `load'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/run_context.rb:75:in `each'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/run_context.rb:75:in `load'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/client.rb:198:in `setup_run_context'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/client.rb:418:in `do_run'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/client.rb:176:in `run'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/application.rb:140:in `run_chef_client'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/application/solo.rb:224:in `run_application'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/application/solo.rb:216:in `loop'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/application/solo.rb:216:in `run_application'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/../lib/chef/application.rb:72:in `run'
/usr/lib64/ruby/gems/1.8/gems/chef-10.16.2/bin/chef-solo:25
/usr/bin/chef-solo:19:in `load'
/usr/bin/chef-solo:19

Default attributes work fine in Chef Solo
I'm not sure what's happening inside your cookbook - but it is an issue with your code, not with Chef. As a simple example, check this out:
https://gist.github.com/adamhjk/6141718

chef solo does not support default attributes.
You're going to need to put together a node.json under your nodes directory which lists the attributes in .json form.
So in your case:
{
"php": {
"version": "5.4.9"
}
}
If you want to use default attributes/any attributes in .rb format, you're going to need to use chef-server/chef-client.

Related

Chef install of readline package fails on Ubuntu 14.04

I am trying get PostgreSQL (server) installed on an Ubuntu node using Chef:
Role definition (roles/base_server.rb):
run_list(
"recipe[apt]",
"recipe[postgres::server]"
)
default_attributes(
postgresql: {
version: "9.3.4",
config: {
shared_buffers_mb: "12000"
}
}
Setup
System: Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
Chef-Version: 11.14.6
Postgres Cookbook: [3.4.1] (https://github.com/hw-cookbooks/postgresql)
Running the bootstrap command
knife bootstrap IPADDRESS -x USER -r 'role[base_server]' --sudo
Results in the following error:
* package[readline] action install
* No version specified, and no candidate version available for readline
================================================================================
Error executing action `install` on resource 'package[readline]'
================================================================================
Chef::Exceptions::Package
-------------------------
No version specified, and no candidate version available for readline
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/postgres/recipes/build.rb
29: package package_name do
30: action :install
31: end
32: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/postgres/recipes/build.rb:29:in `block in from_file'
package("readline") do
action [:install]
retries 0
retry_delay 2
guard_interpreter :default
package_name "readline"
timeout 900
cookbook_name "postgres"
recipe_name "build"
end
I already tried to fix this by installing the readline libraries manually, but no success. Has anyone an idea how to solve this?
As mentioned by StephenKing, the issue isn't with Chef, it is that the package really doesn't exist. You'll need to fix your recipe code to use the correct package name.

rails-api not allowing any generation

I'm struggling trying to get the configuration of rails-api with the mongo_mapper gem.
I'm using rails v 4.1.1
gemfile looks as follows
source 'https://rubygems.org'
gem 'mongo'
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
gem 'bson_ext'
gem 'railties'
I ran rails-api new test-app --skip-active-record which generates a simple file structure.
.
├── Gemfile
├── Gemfile.lock
├── README.rdoc
├── Rakefile
└── config.ru
After that, per the instructions on the README for mongo_mapper I specified the correct version in my gemfile so that it's compatible with Rails 4.
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
According to
- http://mongomapper.com/documentation/getting-started/rails.html
- How can I get mongo mapper to generate the config/mongo.yml file in Rails 4
I should then be able to run bundle exec rails generate mongo_mapper:config. It was here I started running into issues.
I first realized I need railsties gem since it wasn't even letting me run rails generate.
$ bundle exec rails generate mongo_mapper:config
/Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.6.1/lib/bundler/rubygems_integration.rb:248:in `block in replace_gem': railties is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails:22:in `<main>'
After adding that gem it allowed me to run bundle exec rails generate mongo_mapper:config but doesn't actually have access to that mongo generator. The output from the command is the standard rails help info including usage, options etc.
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/colinhhart/.rbenv/versions/2.1.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
What I've tried so far
I've tried building out what the generator is supposed to build as is described in this guide
http://technicaldebt.com/getting-started-with-ruby/mongomapper-ith-rails-quickstart/
But then realized that even if I build that out there's obviously still some "glue" that I'm missing, which ties everything together. I built it out just in case and of course it still didn't work.
I've made sure to bundle and and reload the terminal appropriately.
Like I said, I'm pretty sure there's something necessary that gets skipped when I build the rails-api without active record.
Any thoughts on this? Would greatly appreciate the help.
For what it's worth this is the full output when I ran rails-api new my_app --skip-active-record.
$ rails-api new pitfworld_wide_atrocities_db --skip-active-record
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
(erb):19:in `template': undefined method `name' for []:Array (NoMethodError)
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:in `block in template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:in `create_file'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:115:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:17:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:45:in `gemfile'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/app_base.rb:133:in `build'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:176:in `create_root_files'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/application.rb:17:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/cli.rb:14:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rails-api-0.2.1/bin/rails-api:4:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `load'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `<main>'
Solution
I came across that rails-api issue right as I was writing this post and it turned out that that was the issue, after banging my head forever thinking it was a mongo issue.
The issue has been fixed and closed but hasn't yet been released and will probably be released in rails-api v0.2.2.
Ultimately, I decided to just go into the rails-api source code and apply the changes locally.

Neo4j rake aborted! No such file or directory - wget http://dist.neo4j.org/neo4j-community-1.7-unix.tar.gz

Trying to install and run a simple Neo4j app from Max Demarzi's "d3_js_intro" app on GitHub. Issuing the command rake neo4j:install, I get the message shown below. Questions:
Q: What is the root cause of wget failing to get the file; a file that appears to exist in exactly the place expected? (Note: the URL following the error message "No such file or directory" is valid; that file exists there... so message is incorrect. Why?) A: the root cause was that wget is not installed on a Mac OSX machine. If you are running a Mac OSX machine, you too will need to install wget.
I've tried:
I've manually downloaded the file (http://dist.neo4j.org/neo4j-community-1.7-unix.tar.gz) that the wget was failing to get.
extracting the file to the app root directory.
Questions related to manually recovering from this problem:
Q: Does the manually-extracted directory need to be named anything special? (i.e.: "Neo4j", "neo4j", etc.). A: It would have to be called "neo4j", but the fix (below) eliminates the need to do this.
Q: What configuration files would I need to modify (and how) in order to get the app to see the neo4j server? A: the fix below eliminates the need to deal with this.
The gem files reads:
source 'http://rubygems.org'
gem 'sinatra'
gem 'neography'
gem 'haml'
gem 'json'
group :test do
gem 'rspec'
gem 'rack-test'
gem 'net-http-spy'
end
The Rakefile reads:
require 'neography/tasks'
require './d3.rb'
namespace :neo4j do
task :create do
create_graph
end
end
Thanks for anything you can provide
- HisHighnessDog
rake neo4j:install --trace
** Invoke neo4j:install (first_time)
** Execute neo4j:install
Installing Neo4j-community-1.7
rake aborted!
No such file or directory - wget http://dist.neo4j.org/neo4j-community-1.7-unix.tar.gz
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/gems/neography-0.0.26/lib/neography/tasks.rb:44:in ``'
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/gems/neography-0.0.26/lib/neography/tasks.rb:44:in `block (2 levels) in <top (required)>'
...
...
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `load'
/Users/tomjones/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `<main>'
Tasks: TOP => neo4j:install
Should I be concerned that the Rakefile does not contain a task entry for 'install', while the command I'm running is rake neo4j:install?
Solution: the root cause for the error message is that (OSX machine default): wget is not installed.
Recovery: Install and configure wget:
curl -O http://ftp.gnu.org/gnu/wget/wget-1.14.tar.gz
tar -xzvf wget-1.13.tar.gz
cd wget-1.14
./configure --with-ssl=openssl
make
sudo make install
which wget (to confirm wget is now installed)
Use the current wget download from gnu org's website.
You have to download, unzip and start a Neo4j server. The version is not relevant in this case. Go to http://neo4j.org/download for instruction and download links.

install watir-webdriver always fails

My
$ sudo gem install watir-webdriver --no-ri --no-rdoc
always fails with following error
(I am running Fedora 17, 64-bit, and have ruby-devel installed)
------------------------
Building native extensions. This could take a while...
...........
ERROR: Error installing watir-webdriver:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for ffi.h... *** 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=.
--curdir
--ruby=/usr/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/share/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:506:in `try_cpp'
from /usr/share/ruby/mkmf.rb:931:in `block in have_header'
from /usr/share/ruby/mkmf.rb:790:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:254:in `open'
from /usr/share/ruby/mkmf.rb:284:in `block in postpone'
from /usr/share/ruby/mkmf.rb:254:in `open'
from /usr/share/ruby/mkmf.rb:280:in `postpone'
from /usr/share/ruby/mkmf.rb:789:in `checking_for'
from /usr/share/ruby/mkmf.rb:930:in `have_header'
from extconf.rb:9:in `<main>'
Gem files will remain installed in /usr/local/share/gems/gems/ffi-1.0.11 for inspection.
Results logged to /usr/local/share/gems/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
Please refer to:
https://github.com/Compass/compass/issues/1854
abhi7 commented on Oct 21, 2014
abhi7's solution works for my case
xcode-select --install
sudo gem update --system

install do_postgres with bundle

I have created a Gemfile in my rack application (that previously used .gems). When I run "bundle" I have the following error linked to "do_postgres". I do remember having installed postgres on my machine (mac OS) in the past but it seems the libraries cannot be find. Any ideas ?
...
Using dm-core (1.1.0)
Using dm-do-adapter (1.1.0)
Using dm-migrations (1.1.0)
Installing do_postgres (0.10.5) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
extconf.rb:3: command not found: pg_config --includedir-server
extconf.rb:13: command not found: pg_config --libdir
extconf.rb:13: command not found: pg_config --includedir
extconf.rb:13: command not found: pg_config --libdir
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** 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=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/lib
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/do_postgres-0.10.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/do_postgres0.10.5/ext/do_postgres/gem_make.out
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `each'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `build_extensions'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:198:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Fresh install of postgres with brew fixed the thing: http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 libpq-dev
Fixed for me.