一,brew常用的命令
1,查看brew下载文件的缓存目录liuhongdi@liuhongdideMacBook-Pro Homebrew % brew --cache /Users/liuhongdi/Library/Caches/Homebrew2,查看brew的安装目录
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew --prefix /usr/local也可以:
liuhongdi@liuhongdideMacBook-Pro poem % cd "$(brew --repo)" liuhongdi@liuhongdideMacBook-Pro Homebrew % pwd /usr/local/Homebrew3,列出已安装的软件
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew list ==> Formulae brotli c-ares ca-certificates icu4c libnghttp2 libuv node openssl@1.14,安装node
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew install node安装完成后查看版本:
liuhongdi@liuhongdideMacBook-Pro Homebrew % node -v v19.8.15,查看已安装软件的信息:
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew info node ==> node: stable 19.8.1 (bottled), HEAD Platform built on V8 to build network applications https://nodejs.org/ /usr/local/Cellar/node/19.8.1 (2,357 files, 56.7MB) * Poured from bottle using the formulae.brew.sh API on 2023-04-01 at 12:47:34 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/node.rb License: MIT ==> Dependencies Build: pkg-config ✘, python@3.11 ✘ Required: brotli ✔, c-ares ✔, icu4c ✔, libnghttp2 ✔, libuv ✔, openssl@1.1 ✔ ==> Options --HEAD Install HEAD version ==> Analytics install: 8,413 (30 days), 930,971 (90 days), 4,931,720 (365 days) install-on-request: 7,695 (30 days), 815,366 (90 days), 4,361,602 (365 days) build-error: 32 (30 days)6,查看已安装软件的依赖:
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew deps --installed --tree node node ├── brotli ├── c-ares ├── icu4c ├── libnghttp2 ├── libuv └── openssl@1.1 └── ca-certificates7,卸载软件
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew uninstall node8,搜索:
liuhongdi@liuhongdideMacBook-Pro Homebrew % brew search node ==> Formulae libbitcoin-node llnode node-build node@10 node@14 node@18 nodebrew nodenv linode-cli node node-sass node@12 node@16 node_exporter nodeenv ode ==> Casks capslocknodelay nodebox nodeclipse If you meant "node" specifically: It was migrated from homebrew/cask to homebrew/core.
说明:
「Formulae」:命令行工具、开发库、字体、插件等不含 GUI 界面的软件
「Cask」:含有 GUI 图形化界面的软件,如 Google Chrome、FireFox 、Atom 等
9,安装时指定版本:liuhongdi@liuhongdideMacBook-Pro Homebrew % brew install node@18 ==> Downloading https://formulae.brew.sh/api/formula.jws.json #=#=# ==> Fetching node@18 ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/node%4018-18.15.0.monterey.bottle.1.tar.gz ######################################################################## 100.0% ==> Pouring node@18-18.15.0.monterey.bottle.1.tar.gz ==> Caveats node@18 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have node@18 first in your PATH, run: echo 'export PATH="/usr/local/opt/node@18/bin:$PATH"' >> ~/.zshrc For compilers to find node@18 you may need to set: export LDFLAGS="-L/usr/local/opt/node@18/lib" export CPPFLAGS="-I/usr/local/opt/node@18/include" ==> Summary 标签:node,10,4.0,liuhongdi,Pro,brew,常用命令,liuhongdideMacBook,Homebrew From: https://www.cnblogs.com/architectforest/p/17278459.html