Evan Wang
Evan WangFrontEnd Developer
  • Evan Wang
    Evan WangFrontEnd Developer
  • 前端相关
  • 算法题
  • 日常笔记
  • Chat With AI

Mac开发环配置
常用CSS
日常配置
常用正则
其它
JS新语法

  1. Articles
  1. More
  2. 1-Mac开发环配置.md
目录
Mac 开发环境安装1. 安装 Homebrew3. 安装 yarn4. 下载其他软件5. 代码仓库配置6. Node 镜像地址切换
1241 字
约 4 分钟
更新于 2026/08/20

Mac 开发环境安装

1. 安装 Homebrew

官网 https://brew.sh/

hello.tsx
# 执行官网命令,安装 Homebrew 
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
 
# 查看当前 shell 
which $SHELL
/bin/zsh
 
# MacOS Catalina 以后默认是 zsh
 
```shell
# homebrew 清除 已经安装的 cask APP 安装包:
brew cleanup --prune=all
 

### 2. 安装 nvm 

```bash
brew install nvm

# 设置默认版本
nvm alias default <version>

3. 安装 yarn

brew install yarn

4. 下载其他软件

# Chrome、
# Cursor
# sublime Text、
# Webstorm
# ChashX Pro/Clash Verge
# Chat GPT 客户端

5. 代码仓库配置

github 生成 ssh 链接文件的文档:

一台电脑同时配置 github 和 gitlab 的文章链接

ssh-keygen -t ed25519 -C "your_email@example.com"

同一电脑配置 github 和 gitlab: 添加文件:~/.ssh/config

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519
 
Host gitlab.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519_gitlab
 

6. Node 镜像地址切换

# 查看当前使用的镜像地址:
npm config get registry
 
# 切换到另一个镜像地址:
npm config set registry https://registry.npmmirror.com/
 
# 临时使用指定镜像地址
npm install 包名 --registry=https://registry.npmmirror.com/
 
 
# node 原镜像网站:https://registry.npmjs.org/
# 阿里 node 镜像网站:https://registry.npmmirror.com/