title: $PATH confusion Postgres and Rails on OSX Lion
body: <p>Rails and all my gem files + homebrew installs have been working fine up until this point. </p>
  
  <p>I ran </p>
  
  <pre><code>homebrew install postgresql 
  </code></pre>
  
  <p>and was following the prompts pretty much as indicated in <a href="http://railscasts.com/episodes/342-migrating-to-postgresql" rel="nofollow">this video</a> but it kept giving me error messages saying there is a server already running. I checked</p>
  
  <pre><code>which psql
  </code></pre>
  
  <p>in the terminal and it reported a</p>
  
  <pre><code> usr/bin 
  </code></pre>
  
  <p>location rather than</p>
  
  <pre><code>usr/local/bin 
  </code></pre>
  
  <p>indicating I was using the postgres that comes with osx not the new homebrew install.</p>
  
  <p>When I attempted to start the database server I recieved an error message saying the server is already running. There is a mention of this error message in the postgres help documentation but no real working solution.</p>
  
  <p>Attempting brew doctor confirmed that i needed to change my PATH in .bash_profile.</p>
  
  <p>I came across this little snippet here on stack overflow for the .bash_profile edit.</p>
  
  <pre><code>export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin
  </code></pre>
  
  <p>I saved the file and managed to get postgres up and running fine but then when I went to start a new rails app.</p>
  
  <pre><code>rails new blog -d postgresql 
  </code></pre>
  
  <p>it says </p>
  
  <pre><code>Rails is not currently installed on this system. To get the latest version, 
  simply type:
  
  $ sudo gem install rails
  
  You can then rerun your "rails" command.
  </code></pre>
  
  <p>Any attempt to install does not work until i change the bash_profile file back to what it was before.</p>
  
  <p>If I change it back postgres has the same issue again saying there is already a server running.</p>
  
  <p>Also I thought it might be a launch agent or something but I don't think there are any that are set up.</p>
  
  <p>I figure either something is installed in the wrong place or I have to add something to the .bash_profile?</p>