该渲染由 Shiro API 生成,可能存在排版问题,最佳体验请前往:https://liu-wb.com/posts/technology/1
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装好之后,需要把 zsh 设置为当前用户的默认 shell(这样新建命令的时候才会使用 zsh):
chsh -s /bin/zsh
使用 Homebrew 安装:
brew install zsh-syntax-highlighting
安装成功之后,令编辑 ~/.zshrc 文件,在最后一行增加下面配置:
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
配置步骤,先克隆 zsh-autosuggestions 项目,到指定目录:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
然后,编辑 ~/.zshrc 文件,找到 plugins 配置,增加 zsh-autosuggestions 插件:
plugins=(git zsh-autosuggestions)
先用brwe search nodejs
查看node的版本,然后选择合适的版本安装,我这是安装node@18版本
brew install node@18
安装最后会有提示,安装提示操作
==> 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
🍺 /usr/local/Cellar/node@18/18.18.1: 2,337 files, 51.1MB
==> Running `brew cleanup node@18`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> node@18
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"
按照提示输入
echo 'export PATH="/usr/local/opt/node@18/bin:$PATH"' >> ~/.zshrc