mac 前端环境搭建 homebrew nvm oh-my-zsh code.

安装xcode-select

xcode-select --install

安装homebrew

https://cloud.tencent.com/developer/article/1853162

Brew 替换为国内源Mac

替换brew.git

cd "$(brew --repo)"

git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

替换homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

刷新源

brew update

安装nvm

nvm官网说了不要使用brew安装,因此按照官网的方式安装
https://github.com/nvm-sh/nvm
参考 http://nvm.uihtm.com/

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

安装完了执行

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

安装node 指定node默认环境

安装node
nvm install

指定默认node
nvm use 14.15.3
nvm alias default 14.15.3

安装cnpm
npm install cnpm -g

安装oh my zsh

gitee安装

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装code .

code . 不能快速打开当前路径的控制面板。

打开vscode 快捷键shift+command+p 后输入shell
选择 Install ‘code’ command in PATH

上一篇:mac安装nvm-sh


下一篇:nvm安装vue-cli