ys@mbp ~ % nodebrew -v
zsh: command not found: nodebrew
ys@mbp ~ % node -v
v18.9.0
ys@mbp ~ % brew install nodebrew
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Downloading https://ghcr.io/v2/homebrew/core/nodebrew/manifests/1.2.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nodebrew/blobs/sha256:eed2aeff4fd05a4c2969d670ce9a38bc01832ac90b65a1c773689532cb376660
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:eed2aeff4fd05a4c2969d670ce9a38bc01832ac90b65a1c773689532cb376660?se=2022
######################################################################## 100.0%
==> Pouring nodebrew--1.2.0.all.bottle.tar.gz
==> Caveats
You need to manually run setup_dirs to create directories required by nodebrew:
/usr/local/opt/nodebrew/bin/nodebrew setup_dirs
Add path:
export PATH=$HOME/.nodebrew/current/bin:$PATH
To use Homebrew's directories rather than ~/.nodebrew add to your profile:
export NODEBREW_ROOT=/usr/local/var/nodebrew
zsh completions have been installed to:
/usr/local/share/zsh/site-functions
==> Summary
🍺 /usr/local/Cellar/nodebrew/1.2.0: 8 files, 40.6KB
==> Running `brew cleanup nodebrew`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
ys@mbp ~ % nodebrew -v
nodebrew 1.2.0
Usage:
nodebrew help Show this message
nodebrew install <version> Download and install <version> (from binary)
nodebrew compile <version> Download and install <version> (from source)
nodebrew install-binary <version> Alias of `install` (For backward compatibility)
nodebrew uninstall <version> Uninstall <version>
nodebrew use <version> Use <version>
nodebrew list List installed versions
nodebrew ls Alias for `list`
nodebrew ls-remote List remote versions
nodebrew ls-all List remote and installed versions
nodebrew alias <key> <value> Set alias
nodebrew unalias <key> Remove alias
nodebrew clean <version> | all Remove source file
nodebrew selfupdate Update nodebrew
nodebrew migrate-package <version> Install global NPM packages contained in <version> to current version
nodebrew exec <version> -- <command> Execute <command> using specified <version>
nodebrew prune [--dry-run] Uninstall old versions, keeping the latest version for each major version
Example:
# install
nodebrew install v8.9.4
# use a specific version number
nodebrew use v8.9.4
ys@mbp ~ % ls /usr/local/opt/ | grep node
node
node.js
node@18
nodebrew
nodejs
ys@mbp ~ % nodebrew install-binary stable
Fetching: https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-x64.tar.gz
Warning: Failed to create the file
Warning: /Users/ys/.nodebrew/src/v18.9.0/node-v18.9.0-darwin-x64.tar.gz: No
Warning: such file or directory
curl: (23) Failed writing body (0 != 1134)
download failed: https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-x64.tar.gz
ys@mbp ~ % mkdir -p ~/.nodebrew/src
ys@mbp ~ % nodebrew install-binary stable
Fetching: https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-x64.tar.gz
############################################################################################################################################################################################################ 100.0%
Installed successfully
ys@mbp ~ % nodebrew ls
v18.9.0
current: none
ys@mbp ~ % nodebrew use v18.9.0
use v18.9.0
ys@mbp ~ % nodebrew ls
v18.9.0
current: v18.9.0
ys@mbp ~ %
参考サイト
$ brew doctor すると A newer Command Line Tools release is available. と警告が出たときの対処法 - Qiita
https://qiita.com/yoshikouki/items/94339ea34621b1d1cd2e
MacにNode.jsをインストールする方法 | ibukish Lab+
https://memoribuka-lab.com/?p=914