Skip to content

Instantly share code, notes, and snippets.

@ArturT
Last active March 5, 2020 18:05
Show Gist options
  • Save ArturT/557c411f79e16542145979e50a6b6882 to your computer and use it in GitHub Desktop.
Save ArturT/557c411f79e16542145979e50a6b6882 to your computer and use it in GitHub Desktop.
Postgres 11 to 12 upgrade database failed. Solution to fix it.
brew postgresql-upgrade-database
==> Upgrading postgresql data from 11 to 12...
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/Cellar/postgresql@11/11.7/bin/postgres
Reason: image not found
no data was returned by command ""/usr/local/Cellar/postgresql@11/11.7/bin/postgres" -V"
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "/usr/local/Cellar/postgresql@11/11.7/bin/pg_ctl".
Check your installation.
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old..
==> Creating database...
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/Cellar/postgresql/12.2/bin/postgres
Reason: image not found
no data was returned by command ""/usr/local/Cellar/postgresql/12.2/bin/postgres" -V"
initdb: error: The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/local/Cellar/postgresql/12.2/bin/initdb".
Check your installation.
Error: Upgrading postgresql data from 11 to 12 failed!
==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postg
Error: Failure while executing; `/usr/local/opt/postgresql/bin/initdb /usr/local/var/postgres` exited with 1.
brew reinstall icu4c
# if step failed: "Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postg..."
# then move /usr/local/var/postgres/postgres.old to /usr/local/var/postgres again.
# then run
brew postgresql-upgrade-database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment