Error message: Make sure that `gem install pg -v '0.18.1'` succeeds before bundling
i have a problem with ruby. I tried a lot but nothing works for me.
When i want to start the rails server, i get this error message:
An error occurred while installing pg (0.18.1), and Bundler cannot continue. Make sure that "gem install pg -v '0.18.1" succeeds before bundling.
This is what i tried already:
sudo install gem
bundle install
bundle install --path vendor/cache
gem install pg -v '0.18.1'
When i try gem install pg -v '0.18.1'
i get this error message:
Could not find gem 'pg (>= 0) ruby' in any of the gem sources listed in your Gemfile or installed on this machine. Run
bundle install
to install missing gems.
But bundle install
doesn't work either. I get this error message:
An error occurred while installing pg (0.18.1), and Bundler cannot continue. Make sure that
gem install pg -v '0.18.1'
succeeds before bundling.
I also tried to start the server in a new ruby project.
Nothing helps..
Thanks for your help!
These are my changes in my Gemfile:
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development do
gem 'sqlite3'
end
Solution 1:
If you're on Ubuntu, most likely you're missing a hidden dependency
sudo apt-get install libpq-dev
If you are on OS X, try these steps
- Install Xcode command line tools (Apple Developer site). If you have
it already installed, update it using
brew update
. brew uninstall postgresql
brew install postgresql
gem install pg
Solution 2:
If you are an Ubuntu user you need to do the following prior installing the gem
sudo apt-get install libpq-dev
Then perform gem install pg -v '0.18.1'
or just bundle install
if you have you r gem in a GEMFILE.
Solution 3:
If you are using Mac and Homebrew, Looks like libpqxx lib was missing.
brew install libpqxx
This command should do it.
Solution 4:
If you are not sure where your pg_config is, and assuming you are on Linux or Mac, you can run the following command:
which pg_config
this will return ==> /usr/pgsql-9.1/bin/pg_config
now use this path as
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Done now bundle install