Fixing a dyld error

I use homebrew on my Mac and recently ran into the error below:

dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/opt/yara/lib/libyara.3.dylib
Reason: image not found
Trace/BPT trap: 5

The homebrew documentation has a wonderful troubleshooting section.

The three commands below fixed my error, but the last might be all that is required if you have the same issue.

$ brew update && brew update && brew doctor
$ brew unlink pcre && brew link --overwrite pcre
$ Error: No such keg: /usr/local/Cellar/pcre
$ brew install pcre