New to coding and just installing Ruby on Rails and getting this error message when trying to create rails app: An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that gem install pg -v '0.18.4'
succeeds before bundling. please help.
Asked
Active
Viewed 5,043 times
0

Gumbo
- 643,351
- 109
- 780
- 844

Brendan Mosweu
- 1
- 1
- 1
-
so what happens when you run gem install pg -v '0.18.4' ? – ruby_newbie Jan 06 '16 at 19:44
-
ERROR: Error installing pg: ERROR: Failed to build gem native extension. – Brendan Mosweu Jan 06 '16 at 19:48
-
did you install postgresql? – Chris Jan 06 '16 at 19:48
-
You don't say what platform you're running on but if you're on Debian-based distributions (i.e. using `apt`), you need to install `libpq-dev` for the `pg` gem to work. – Mourndark Mar 30 '16 at 09:13
4 Answers
1
If you are using Ubuntu, the answer from Mourndark's comment is pretty accurate. Install libpq-dev and you will be ready to go.

Russia Must Remove Putin
- 374,368
- 89
- 403
- 331

jdmaster
- 11
- 1
0
You need to install the postgresql database.
Please check this question: An error occurred while installing pg (0.17.1), and Bundler cannot continue

Community
- 1
- 1

Celso Martins
- 1
- 1
0
Unclear what environment you are working in, but this post should contain a majority of the possible fixes (you most likely need to install PostgreSQL locally) in addition to what Celso Martins posted: Installing PG gem on OS X - failure to build native extension

Community
- 1
- 1

Remain Zany
- 43
- 9
-
am getting this Warning: postgresql-9.4.5_2 already installed, it's just not linked – Brendan Mosweu Jan 06 '16 at 20:01
-
-
An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that `gem install pg -v '0.18.4'` succeeds before bundling. – Brendan Mosweu Jan 06 '16 at 20:19
-
What method did you use to install PostgreSQL? MacPorts? @BrendanMosweu – Remain Zany Jan 06 '16 at 20:23
-
PostgreSQL You can install PostgreSQL server and client from Homebrew: brew install postgresql Once this command is finished, it gives you a couple commands to run. Follow the instructions and run them: # To have launchd start postgresql at login: ln -sfv /usr/local/opt/postgresql/*plist ~/Library/LaunchAgents # Then to load postgresql now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist By default the postgresql user is your current OS X username with no password. For example, my OS X user is named chris so I can login to postgresql with that username. – Brendan Mosweu Jan 06 '16 at 20:26
-
I also tried to fix the problem by installing using Graphical installer – Brendan Mosweu Jan 06 '16 at 20:28
-
The location of pg_config is likely the issue. Check these posts: http://stackoverflow.com/questions/19625487/impossible-to-install-pg-gem-on-my-mac-with-mavericks – Remain Zany Jan 06 '16 at 20:30
-
http://stackoverflow.com/questions/9234960/gem-install-pg-with-pg-config-works-bundle-fails @BrendanMosweu – Remain Zany Jan 06 '16 at 20:30
0
I executed
sudo apt-get remove libpq5
and
sudo apt-get install libpq-dev
and after bundle install

Juan Camilo Camacho Beltrán
- 93
- 1
- 6