Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。
安装:
-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
安装任意包
$ brew install <packageName>
卸载任意包
$ brew uninstall <packageName>
-
查询可用包
$ brew search <packageName>
-
查看已安装包列表
$ brew list
-
查看任意包信息
$ brew info <packageName>
-
更新Homebrew
$ brew update
-
查看Homebrew版本
$ brew -v
通过 homebrew 安装:brew install mongodb
如果报错:
mongodb: A full installation of Xcode.app 8.3.2 is required to compile this software. Installing just the Command Line Tools is not sufficient. Xcode can be installed from the App Store. Error: An unsatisfied requirement failed this build.
说明Xcode版本过低,需要更新,如果你不想更新,可以通过使用命令:
homebrew search mongodb
查看更低版本的MongoDB,然后安装更低版本的MongoDB。
brew install mongodb@3.4
启动MongoDB服务:
brew services start mongodb@3.4
关闭MongoDB服务:
brew services stop mongodb@3.4
进入MongoDB图形化界面:
mongo
查看homebrew安装的服务情况:
brew services list