Mac os 系统安装 MongoDB,怎么使用 brew 安装 MongoDB

# 更改设置 brew 镜像 **阿里云 brew 镜像地址** ``` json # 替换brew.git cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # 替换homebrew-core.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # 刷新源 brew update ``` **清华 brew 镜像地址** ``` json # 替换brew.git cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # 替换homebrew-core.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # 刷新源 brew update ``` 2选1,这里的内容转自于 <a href="https://blog.csdn.net/weixin_43902730/article/details/88261760" target="_blank">Mac的brew修改国内源</a>,感谢博主 `springxf` 的博文. # 安装 MongoDB ``` json #首先tap一个仓库 brew tap mongodb/brew #安装社区版,可以后面加@带上版本,如:mongodb-community@4.2默认安装最新版 brew install mongodb-community ``` 参考链接 <a href="https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/" target="_blank">Install MongoDB Community Edition on macOS</a>