Reputation: 1515
I used brew to install postgresql, and also used install the pg Gem along with it. However, when i try running createuser databasename i get this error:
createuser: could not connect to database postgres: FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
I've tried completely uninstalling from brew, the gem and the /usr/local/var/postgres file and still doesn't work after i do a reinstall(strange thing is, when i do a reinstall and try to initdb, it says the file is not empty?)
a bit of google search and i found some solutions but i have no idea how to do them
the last 2 instructions is pretty straight forward, but i have no idea how to do the first 2
any suggestions?
Upvotes: 0
Views: 472
Reputation: 1427
I imagine you came across Postgres is failing with 'could not open relation mapping file “global/pg_filenode.map” ' To clarify the first two steps:
$ launchctl stop homebrew.mxcl.postgresql
$ killall postgres
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
The caveats for the postgres formula have more info, which you can view with brew info postgres
:
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/Homebrew/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To reload postgresql after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Upvotes: 1