The Complete Guide to Modern Development Environment Setup on M-Series Mac
This is a comprehensive guide tailored specifically for Apple Silicon (M1/M2/M3) chips. It covers not only the installation of essential tools but also addresses pain points like GitHub connectivity issues and native build script blocking in development environments.
Phase 1: Essential Development Environment Setup
On M-series chips, aligning paths and architectures is crucial for stability.
1. Install Homebrew (Package Manager)
On Apple Silicon, Homebrew installs to /opt/homebrew by default.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Configure Environment Variables:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofileeval "$(/opt/homebrew/bin/brew shellenv)"2. Install fnm (Node.js Version Manager)
fnm natively supports ARM64 and is currently the most performant Node manager for macOS.
brew install fnmAdd the following to ~/.zshrc to automatically switch Node versions when entering project directories:
echo 'eval "$(fnm env --use-on-cd --shell zsh)"' >> ~/.zshrcsource ~/.zshrc3. Install pnpm (Core Package Manager)
Recommended to install separately via Homebrew with optimized global configuration:
brew install pnpmpnpm setupsource ~/.zshrcKey Optimization: Allow automatic execution of native module build scripts (like Gemini CLI, Sharp, etc.) to avoid M-chip compilation errors:
pnpm config set -g ignore-scripts falsePhase 2: GitHub Secure Connection and Network Tunneling
Resolve common connection timeout or reset issues through SSH-over-HTTPS (port 443) with proxy tools.
1. Global Identity Configuration
Replace the placeholders below with your own GitHub information:
git config --global user.name "<your_username>"git config --global user.email "<your_email@example.com>"git config --global init.defaultBranch main2. Generate ED25519 Key
ssh-keygen -t ed25519 -C "<your_email@example.com>"Run cat ~/.ssh/id_ed25519.pub and add the content to GitHub SSH Settings.
3. Write a “Universal” SSH Config File
Edit ~/.ssh/config to ensure traffic goes through your designated proxy port (example uses 7897):
Host github.com HostName ssh.github.com Port 443 User git IdentityFile ~/.ssh/id_ed25519 AddKeysToAgent yes UseKeychain yes # Force through local proxy (modify port based on your proxy tool) ProxyCommand nc -X 5 -x 127.0.0.1:7897 %h %pPermission Fix:
chmod 600 ~/.ssh/configPhase 3: Standardized Development Workflow
Once the environment is ready, following a standardized workflow greatly improves collaboration and maintenance efficiency.
1. Environment Check
After entering a project directory, verify that the environment is correctly aligned:
node -v && pnpm -v2. Dependency Management
With script execution enabled, native modules will automatically complete local compilation during installation:
pnpm install3. Conventional Commits
We recommend using the Conventional Commits specification to keep commit history clear:
feat:New featurefix:Bug fixchore:Build process or auxiliary tool changesdocs:Documentation changes
Tip: You can use AI tools to help generate proper commit messages:
git diff --cached | <ai_tool_command> "Generate English commit message based on changes"4. Push and Sync
git pull origin main # Pull before pushing to avoid conflictsgit push origin mainPublished at: Feb 12, 2026 · Modified at: Feb 12, 2026