Brew install mongodb encountered an installation error on the Mac, and the directory /usr/local/opt/pkg-config could not be found.

  mongodb, question

Brew install mongodb encountered an installation error on the Mac, and the directory /usr/local/opt/pkg-config could not be found.

图片描述

clipboard.png
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.