初始化New Mac
![初始化New Mac](https://img.090227.xyz/file/ae62475a131f3734a201c.png)
备份对Mac的编程环境配置
在开始新的Mac初始化之前,确保备份当前Mac上的编程环境配置,以便快速恢复到新设备上。
系统设置命令
1.取消4位数密码限制
在Mac上,系统默认可能限制了密码的复杂度,例如只允许使用4位数的密码。为了提升安全性,可以通过以下命令取消这一限制:
1
| pwpolicy -clearaccountpolicies
|
2.允许安装任意来源的 App
1
| sudo spctl --master-disable
|
3.xcode 命令行工具
4.程序坞自动隐藏加速
1 2 3 4 5 6 7 8 9 10 11
| defaults write com.apple.dock autohide-time-modifier -float 0.5 && killall Dock
defaults write com.apple.dock autohide-delay -int 0 && killall Dock
defaults delete com.apple.dock autohide-time-modifier && killall Dock
defaults delete com.apple.Dock autohide-delay && killall Dock
|
5.启动台自定义行和列
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
defaults write com.apple.dock springboard-columns -int 9
defaults write com.apple.dock springboard-rows -int 6
killall Dock
defaults write com.apple.dock springboard-rows Default defaults write com.apple.dock springboard-columns Default
killall Dock
|
开发环境配置
1.安装 Homebrew
1
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
brew 的基本使用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| brew update
brew search [关键词]
rew info [软件名]
brew list
brew upgrade [软件名]
brew cleanup
brew uninstall [软件名]
|
brew 常用软件推荐:
1 2 3 4 5 6 7 8
| brew install cask
brew install qlmarkdown
brew install syntax-highlight
|
2.安装 Oh My Zsh
1
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
安装 Oh My Zsh 插件
1 2 3 4 5 6 7 8
| brew install autojump
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
|
3.Git
1 2 3 4 5
| git config --global user.email "xxxxx@xxx.com"
git config --global user.name "name"
|
4.Vim
macOS 自带的 vim 是没有任何配色的,可以下面是国光常用的配色方案,先在用户目录下新建一个 vim 的配置文件:
内容如下:
1 2 3
| set nu " 显示行号 colorscheme desert " 颜色显示方案,其他方案查看:ls /usr/share/vim/vim*/colors syntax on " 打开语法高亮
|
5.Node.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| ➜ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
➜ zsh ➜ nvm --version 0.39.3
➜ nvm version
➜ nvm install stable
➜ nvm ls-remote
➜ nvm install v18.16.1 ➜ nvm install <version>
➜ nvm ls
➜ nvm uninstall <version>
➜ nvm use <version>
➜ nvm current
|
6.ADB 安装
1 2
| brew install --cask android-platform-tools
|
7.Hexo
1 2 3 4 5 6 7 8 9 10 11 12
| npm install -g hexo-cli
brew install hexo
hexo init
hexo generate
hexo server hexo new <name>
|