0%

重装Mac后要做的事

我每年在 Mac 大版本系统更新 2 到 3 个小版本后,会重新安装一次系统。Time Machine 全盘备份只用来恢复个人文件,软件以及相关的 Preference 都会重新配置。

为了配置尽量高效不遗漏,在这里记录一份,方便以后查阅。

终端配置(iTerm2)

  1. 导入提前备份的 iterm2 配置文件;
  2. 安装 DejaVu Sans Mono for Powerline 字体,字号14;
  3. 安装 brew 软件包管理系统:
    1
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  4. 安装 oh-my-zsh 命令行工具:
    1
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  5. brew 安装 auto-suggestions 插件,在 .zshrc 中启用插件:
    1
    brew install auto-suggestions
  6. brew 安装 zsh-syntax-highlighting 插件,在 .zshrc 中启用插件:
    1
    brew install auto-suggestions
  7. 在 .zshrc 中更改主题为 agnoster。

博客部署

  1. 克隆到本地:
    1
    git clone git@github.com:ricmarlene/ricmarlene.github.io.git
  2. 安装 node:brew install node
  3. 安装 hexo 博客框架:npm install hexo-cli -g
  4. 进入博客目录,安装 node 依赖包:
    1
    cd ricmarlene.github.io && npm install
  5. 查看 hexo 运行是否正常 hexo clean && hexo g && hexo s
  6. 可以安装 npm-check 和 npm-upgrade,升级 hexo 及相关组件,升级过后删除 node_modules 文件夹和 package-lock.json 文件,重新运行 npm install 命令:
    1
    2
    3
    npm install -g npm-check
    npm install -g npm-upgrade
    npm install
  7. 配置 Git:
    1
    2
    git config --global user.email "mr.myric@gmail.com"
    git config --global user.name "ricmarlene"
  8. 配置 Deploy Key,上传公钥到Repository 的 Deploy Key 页面:
    1
    ssh-keygen -t rsa -b 4096 -C "mr.myric@gmail.com"
  9. 备份博客:
    1
    2
    3
    git add .
    git commit -m "..."
    git push origin backup
  10. 部署博客:hexo clean && hexo g && hexo d

免密码ssh登陆另一台mac

1
2
3
ssh-keygen //生成公钥私钥
ssh-copy-id -i [公钥文件] user@host
ssh-add -K [你的私钥文件,就是那个不加.pub结尾的文件]