Even though I am currently deep into a project which is coming closer to launch and despite trying to not upgrade yet, I couldn’t wait to install Yosemite on my main machine. So I did. Luckily everything works and it was an easy upgrade process. The only thing that needed a little bit of work was a problem with PostgreSQL not starting anymore, which I found after getting an error trying to start the rails server.
Disclaimer: PostgreSQL is one thing which I don't know much about at all, but this fix doesn't involve anything that could break your machine, so I thought it might be worth posting.
$ rails s … /Users/foobartel/.rvm/gems/ruby-2.1.2@ik/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad) Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I checked the log file (
/usr/local/var/postgres/server.log) and found these lines:
FATAL: could not open directory "pg_tblspc": No such file or directory FATAL: could not open directory "pg_twophase": No such file or directory
I did a Google search for these two lines and found this article on StackOverflow, which seemed to provide the fix. Since this was an easy one to try, I just created these directories.
mkdir /usr/local/var/postgres/pg_tblspc mkdir /usr/local/var/postgres/pg_twophase mkdir /usr/local/var/postgres/pg_stat_tmp
Starting the PostgreSQL with
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
then worked. Problem solved. If you ran into the same thing and see the same fatal errors in your log file, I hope this solution works for you as well. Just to be on the safe side, don't forget to create a backup if you haven't done so already.