Arm Mac 的编译环境配置
大约 2 分钟
添置了 mbp14 ,记录下开发环境的配置
安装 Homebrew
使用科大源安装,具体见 官方文档
# 设置环境变量
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
# 运行安装脚本(cdn版)
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/Homebrew/install@HEAD/install.sh)"
运行之后就开始刷命令行,会要求输入 sudo 密码,需要注意的就是后面有一步下载和安装 Command Line Tools for Xcode
时间会比较久,这要它也没有进度条,看起来就像失去响应了一样,这里只要没有报错,就耐心等待吧。
第一遍安装给我报了个错 Fetching /opt/homebrew failed!
,我直接拿安装脚本又安装了一遍,这次就可以了,命令行最后输出了
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/leo/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run these commands in your terminal to add the non-default Git remotes for Homebrew/brew and Homebrew/homebrew-core:
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"' >> /Users/leo/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"' >> /Users/leo/.zprofile
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
按照命令里要求的依次执行这些命令后,输入 brew -v
,能看到输出版本号,就算安装完了
安装 Git
brew install git
# 查看 git 版本
git --version
# 生成公私钥
ssh-keygen -o
# 查看公钥
cat ~/.ssh/id_rsa.pub
安装 Node 及相关
访问 官网 下载最新的稳定版安装包,下载完成后一路下一步即可
# 安装 pnpm
brew install pnpm
# 安装 nvm,并按照输出操作
brew install nvm
# 安装 nrm
sudo npm install -g nrm
安装 Docker
访问 官网 下载 Docker Desktop
安装 oh my zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# set alias
vim ~/.zshrc
# alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
# 在文件底部按照示例新增后运行使生效
source ~/.zshrc
一键同步
- VSCode 使用 Settings Sync 插件,一键同步插件配置
- Chrome 登录账号,一键同步插件及书签
Loading...