Brew install mongodb encountered an installation error on the Mac, and the directory /usr/local/opt/pkg-config could not be found.
In case of installation problems, they are solved from top to bottom. Generally speaking, they are all lack of dependent packages. It is good to install them. In the figure, you need to install xcode-select first, and then reinstall pkg-config.