Rails and Postgres aren't getting along after switching from Macports to Homebrew; PGError: ERROR: unrecognized time zone name: “UTC”
-
08-10-2019 - |
Question
I moved everything that I had in /opt/local
(where Macports' things lived) into ~/.macports
. That included my old postgres database cluster.
Then I installed postgres using Homebrew and ran the setup that it told me to (creating a new database cluster in /usr/local
).
In my project, I ran rake db:drop:all
and rake db:create
. These did their work cheerfully.
But when I tried to rake db:migrate
, postgres and rails fight and tell me
rake aborted!
PGError: ERROR: unrecognized time zone name: "UTC"
: SET time zone 'UTC'
I don't know what they're talking about, though. I found this article about a config.time_zone
bug slightly illuminating, but not enough to find my way.
Thanks!
Solution 3
I'm not completely sure how I fixed it, but uninstalling Postgres and reinstalling it (and following the setup instructions it gives very carefully) got it working.
OTHER TIPS
I was getting this error and simply need to start postgres manually:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
You can also stop it:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
After much head banging, I solved this problem by running:
env ARCHFLAGS="-arch x86_64" gem install pg