Mac必备,包管理 brew

一行命令即可安装包管理工具 brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
1

接下来可以安装你需要的命令或软件。

比如 Mac 下默认没有 wget ,安装之。

$ wget https://dhcp.cn
-bash: wget: command not found

$ brew install wget
Updating Homebrew...

$ wget https://dhcp.cn
正在解析主机 dhcp.cn (dhcp.cn)... 159.75.190.197
正在连接 dhcp.cn (dhcp.cn)|159.75.190.197|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:20111 (20K) [text/html]
正在保存至: “index.html”
已保存 “index.html” [20111/20111])
1
2
3
4
5
6
7
8
9
10
11
12
13

也可以安装 NGINX 这种软件。

brew install nginx
1

安装后关键路径如下:

  • HTML 路径: /usr/local/var/www
  • 配置文件: /usr/local/etc/nginx/

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo.

  • 启动命令: brew services start nginx

另外,也可以使用 brew config 检查 brew 的配置,或使用 brew doctor 检查 brew 是否运行正常。