Feb-27, 2025 · 10min
change languageComprehensive guide to setting up a Mac development environment, including Homebrew installation, Oh My Zsh configuration, Powerlevel10k theme settings, VSCode configuration, Git and SSH settings, and more.
Ensure a good network environment
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, you will need to execute several commands to set environment variables, as prompted
Clone the repository
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
Copy the template file
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
Reload the configuration
source ~/.zshrc
Clone the repository
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
Add to .zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
Reload the configuration
source ~/.zshrc
Install the font file that supports icons
Terminal settings use font
Custom configuration
p10k configure
Configure the data to be displayed
Configure the node version and package.json version to be displayed
vim ~/.p10k.zsh
Install zsh plugins
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Add to .zshrc
plugins=(
git
sudo
z
zsh-autosuggestions
zsh-syntax-highlighting
)
Complete file .zshrc, the file name is .zshrc
Generate ssh keys
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com"
View ssh public key
cat ~/.ssh/id_ed25519.pub
Global user name email
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
Current repository user name email
git config --local user.name "Your Name"
git config --local user.email "email@example.com"
Configure quotepath
option
Avoid Chinese path乱码
git config --global core.quotepath false
Do not ignore case
git config --global core.ignorecase false
Complete configuration .gitconfig
[user]
name = "Your Name"
email = "email@example.com"
[core]
quotepath = false
ignorecase = false
Generate multiple ssh keys
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com" -f ~/.ssh/id_ed25519
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com" -f ~/.ssh/id_ed25519_gitlab
Configure ssh configuration file
vim ~/.ssh/config
Complete configuration .ssh/config
# Personal account, - the default config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
# Work account-1
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519_gitlab
IdentityFile
is the ssh key configured for the current Host
ProxyCommand
is the proxy configured for the GitHub repository, using thenc
command,127.0.0.1:7890
is the local proxy port
Only when the desktop wallpaper is displayed when the front is scheduled
Adjust the size of the mouse pointer
Disable automatic capitalization
vim settings keyboard repeat
Global open keyboard long press continuous input
defaults write -g ApplePressAndHoldEnabled -bool false