0

I have tried all methods listed on other pg topics such as this one and this. All this time I have been able to get away by running bundle install --without production. However, this time I need to use a gem that requires pg gem. I need to actually install pg to my machine (OSX El Capitan 10.11.5)

I feel like my best bet is to use suggestion on this post to use postgres.app. I have tried:

I recommend that you try to use Postgres.app. (http://postgresapp.com) This way you can easily turn Postgres on and off on your Mac. Once you do, add the path to Postgres to your .profile file by appending the following:

PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

and also tried configuring my path on .bash-profile as said here, but none work.

Another problem I am seeing is, whenever I type command which_psql (edit: which psql)it returns nothing (nothing happens) - is that supposed to happen?

I have tried:

Having on my .bash_profile: export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin and then run gem install pg

Type this on .profile PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH" and then run gem install pg.

Did I do anything wrong? I notice that postgres.app can be turned on and off. I have had it on the whole time. Do I have to turn it on before running gem install pg? What is the proper way to install pg gem using postgres.app, step by step?

Community
  • 1
  • 1
Iggy
  • 5,129
  • 12
  • 53
  • 87
  • Try `which psql` and not `which_psql` – Arun Kumar Mohan Aug 16 '16 at 01:25
  • it still does not do anything. I tried running the command on the project folder and home: `which psql`. – Iggy Aug 16 '16 at 01:26
  • Have you installed `postgresql` locally in your machine? – Arun Kumar Mohan Aug 16 '16 at 01:27
  • Are you using Homebrew? You can install PostgreSQL via Homebrew and it should give you post install instructions about setting it up as a service. This has worked well for me. – kcdragon Aug 16 '16 at 02:25
  • @kcdragon I have RVM. Will it conflict if I use both homebrew and RVM? – Iggy Aug 16 '16 at 03:58
  • @ArunKumar do I have to install postgresql locally even if I have postgres.app running? – Iggy Aug 16 '16 at 03:58
  • No, it will not conflict. Homebrew is a general purpose package manager for Mac OSX. RVM is specifically for managing versions of Ruby. – kcdragon Aug 16 '16 at 03:59
  • Cool! I just checked it. It seems like I already have homebrew installed. What is the best way to install postgresql? Also, I don't really know DB very much - do I have to install postgresql once to my machine and that will solve future `pg` installs, or do I have to install postgresql everytime I run new rails app? – Iggy Aug 16 '16 at 04:01
  • @Iggy No, Looks like postgres.app installs PostgreSQL in your machine. Did you follow the instructions given in http://postgresapp.com/documentation/cli-tools.html ? – Arun Kumar Mohan Aug 16 '16 at 04:01
  • @ArunKumar yes, I followed it. I did the "Configure your $PATH" section; on `~/.bash_profile` I have `export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin` saved. Edit: I typed `which psql` again and it showed a path (it didn't before): `/Applications/Postgres.app/Contents/Versions/latest/bin/psql`. Do you know what is the next step? – Iggy Aug 16 '16 at 04:06
  • @Iggy What do you mean by next step? You have setup a CLI(Command Line Tool) by adding the environmental variable. You can now start the server by clicking on the application in `/Applications` or use CLI to do that. If you close the application, the server will shut down. PS: I have never used postgres.app – Arun Kumar Mohan Aug 16 '16 at 04:10
  • 1
    @Iggy, Read [this](http://postgresapp.com/documentation/configuration-ruby.html) to know how to configure the db for rails. – Arun Kumar Mohan Aug 16 '16 at 04:13

0 Answers0