mac(M1)web前端环境配置

560 阅读1分钟

电脑又让我给弄格式化了(第三次),特此记录一下配置过程!!!

2022年7月15日

先展示一下目前电脑的系统版本以及应用

  1. macosMonterey(版本 12.4)
  2. google浏览器(重要性母庸置疑)
  3. Xcode(下载完成后,打开软件勾选下协议,就可以关掉了)
  4. item2(赏心悦目的终端)
  5. HomeBrew

建议先安装iterm2和oh-my-zsh

安装nvm切换不同版本的node (zsh)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  1. 如果安装缓慢建议在hosts文件中添加
185.199.108.133 raw.githubusercontent.com
  1. command not found: nvm

办法不是唯一的,但都大同小异--> 解决办法

  1. nvm install 16 安装16版本的node

安装nrm切换node源

  1. npm i -g nrm
  2. nrm test 检测不同源的速度
  3. nrm use taobao (切换源此处以taobao源为例)

brew安装

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  1. 该命令为国内安装源,国内用户推荐使用此命令。
  2. 安装成功 但还需要重启终端 或者 运行 source /Users/star/.zprofile 否则可能无法使用
  3. brew doctor检测brew是否有错误(若有warning按照提示进行操作)

安装yarn

  1. brew install yarn

以上环境基本ok了下面根据自己心情安装

oh-my-zsh

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

  1. 如果先安装了nvm,这时候会command not found: nvm
  2. 主题建议使用 apple 很清爽

oh-my-zsh 高亮插件 zsh-syntax-highlighting 强烈推荐

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

oh-my-zsh 自动补全插件 zsh-autosuggestions 推荐

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

安装完成之后需要配置zsh的配置文件不然不起作用

  1. 打开.zshrc
  2. 在plugins中增加 zsh-autosuggestions zsh-syntax-highlighting
  3. zsh-syntax-highlighting放在最后一个

下面是一些常用工具

  1. vscode建议大家登陆一下账号,以后换电脑时该账号的配置以及插件会同步
  2. bob英语小白建议安装
  3. 超级右键lite appStore即可安装 右键增强工具
  4. paste 剪贴板增强工具可以保存历史记录
  5. postman 不必多说
  6. proxyman 抓包工具
  7. Charles热门抓包工具,不会破解的可以使用上面那个