I was trying to upgrade g++ with homebrew, but after getting stuck on 'make' for 2 hours, I decided something was wrong so I cancelled the process. Now each time I open terminal I see this error message;
Last login: Fri Apr 20 20:50:24 on ttys000
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.4.dylib
Referenced from: /usr/local/bin/awk
Reason: image not found
I don't know what it means in this context or how I can solve it. I haven't noticed any other issues caused by this yet. Any help is appreciated.
Additional info: Prior to this, I had re-installed xcode by deleting it manually and installing it from the appstore. I had not re-opened a terminal window after this, so this might also be the culprit.
Update 1: I tried to upgrade gcc with brew again and it successfully upgraded to 7.3 without getting stuck. But the issue persists. I also found another symptom. When I try to Install gmp-6.1.2, './configure' yields;
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.4.dylib
Referenced from: /usr/local/bin/gawk
Reason: image not found
./config.status: line 1645: 74683 Done(141) eval sed \"\$ac_sed_extra\" "$ac_file_inputs"
74684 Abort trap: 6 | $AWK -f "$ac_tmp/subs.awk" > $ac_tmp/out
config.status: error: could not create demos/pexpr-config.h
Given the similarity of the errors I thought the cause of the errors are the same.
Reposting my solution as an answer:
Upon looking into the folder mentioned in the error message I found out that I had libmpfr.6.dylib instead of libmpfr.4.dylib. This probably changed when I upgraded g++.
Updating gawk with homebrew made it look for the right file.
brew upgrade gawk