I have got a similar error now on macOS Catalina, but I was not able to successfully run
gem install pg -v '0.18.4'
I found this issue in the puma gem (I know this is another gem) that helped me solve the issue: https://github.com/puma/puma/issues/2304.
There, I found this:
Clang now enables
-Werror=implicit-function-declarationby default:Clang now reports an error when you use a function without an explicit
declaration when building C or Objective-C code for macOS
(-Werror=implicit-function-declarationflag is on). This additional
error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit
targets for this diagnostic. (49917738)
And this:
gem install puma:4.3.5 -- --with-cflags="-Wno-error=implicit-function-declaration"
So, I was able to build pg with:
gem install pg -v '0.18.1' -- --with-cflags="-Wno-error=implicit-function-declaration"