1

Trying to start my rails server on my development machine gave me this error:

PG::ConnectionBad - could not connect to server: Connection refused
     Is the server running on host "localhost" (::1) and accepting
     TCP/IP connections on port 5432?

Looking at the server log, I found that it was looking for icu4c version 63 but I was on icu4c version 64.2. Following the instructions here I was able to reinstall icu4c version 63.1. I could then start my server. Doing psql --version informed me I was running 11.2.

But, then when I started my rails console, when I enter a command

I receive the warning message:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
=> true

How do I fix this?

Obromios
  • 15,408
  • 15
  • 72
  • 127
  • Is it on your development machine? I had a same problem on my computer and at the end the best solution was to reinstall Postgres with the new version of icu4c. If you can afford to reinstall Postgres, just do it, it is the simplest solution. – edariedl Aug 18 '19 at 08:07
  • Obromios, it looks like the current version of postgres on homebrew is 11.4. So if you don't mind this version, you can go with `brew upgrade postgresql` – edariedl Aug 19 '19 at 06:15
  • That is awesome :). Glad to help. Yes I'll answer it, I'll just think it through a little to find if I can add anything else that would be useful. – edariedl Aug 22 '19 at 06:14

1 Answers1

1

If you only have seeded data as is often the case on a development machine, you should reinstall or upgrade your PostgreSQL installation. It is probably the best way to do it. If you do have important data on the machine and go this route, then you should back it up first.

On the Mac you can do just brew upgrade postgresql for upgrade, and it should work fine if it is between two minor versions, eg. 11.2 to 11.5. If it involves a major upgrade, e.g 10.4 to 11.5, you need to do a brew postgresql-upgrade-database, after the database upgrade. Be warned, that this does make a copy of the older database and then migrates it to the new format, but it may involve some additional clean up steps.

You can also change the used version of icu4c. See the answer to this question dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac

On your dev machine you should be able to lose your data but if you cannot, you should look for the installed PostgreSQL versions. Database formats can change between major versions.

Obromios
  • 15,408
  • 15
  • 72
  • 127
edariedl
  • 3,234
  • 16
  • 19