Mac & Windows 新机配置开发环境

此处仅做备忘记录。

  1. 安装 Homebrew

    /bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  2. 安装 Git

    brew install git
  3. 安装 oh-my-zsh

    # 安装oh-my-zsh
    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    # 安装highlight插件
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    # 安装auto suggestion插件
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    # 编辑.zshrc
    vim ~/.zshrc
    plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Windows 环境下,可以 WSL + ohmyzsh 和 Git Bash + zsh,后者大致顺序如下:

  1. 安装 Git Bash,新版记得勾选 (NEW!) Add a Git Bash Profile to Windows Terminal
  2. 安装配置 Zsh
  • 进入 MSYS2 Packages ,点击下载 zsh 的.tar.zst压缩包
  • 解压,复制 etc、usr 两个文件夹到 C:\Programe Files\Git 安装目录
  • 打开 Git Bash,执行zsh,暂时先不进行其他设置,直接输入 0 结束并生成 .zshrc 配置文件即可
  • 配置 zsh 为 Git Bash 的默认 shell 。在 ~/.bashrc (用户主目录)中添加如下内容
 # Enable zsh
 if [ -t 1 ]; then
    exec zsh
 fi
  1. 重复 Mac 下的步骤3 即可。

参考链接:
https://ifuyao.com/blog/install-zsh-and-oh-my-zsh-in-windows-git-bash/
https://juejin.cn/post/7229507721795993661
https://www.yuque.com/u39265547/mmhy5y/prcvghdxpniefeio?singleDoc#

本文链接:

https://ma.ge/archives/675.html