mac 开发环境配置

1. 安装 Xcode

通过 App Store 安装 Xcode。

2. 安装 Homebrew

  1. 编辑 Shell 配置文件 .zshrc,添加镜像:

    # HomeBrew
    export HOMEBREW_INSTALL_FROM_API=1
    export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
    export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
    export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
    export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
    # HomeBrew End
    
  2. 安装 Homebrew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  3. 配置 Homebrew 路径:

    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/chenwenshun/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
    
  4. 配置 Git 源:

    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/chenwenshun/.zprofile
    echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> /Users/chenwenshun/.zprofile
    echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> /Users/chenwenshun/.zprofile
    export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
    export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
    
  5. 验证安装:

    brew help
    

3. 安装 iTerm2

使用 Homebrew 安装 iTerm2:

brew install --cask iterm2

4. 安装 JDK(最快方式)

  1. 从 Azul Downloads 下载适用于 ARM 架构的 JDK ZIP 或 TAR.GZ 文件。
  2. 解压缩 ZIP 文件。
  3. 验证安装:
   <your_installation_folder>/bin/java -version
  1. 编辑 Shell 配置文件 .zshrc,添加 JDK 路径:
export JAVA_8_HOME=<your_installation_folder>
# 例如:/Users/chenwenshun/jdk/zulu8.78.0.19-ca-jdk8.0.412-macosx_aarch64
export JAVA_HOME=$JAVA_8_HOME
export PATH=$PATH:$JAVA_HOME/bin

5. 安装 Maven

  1. 从 Apache Maven Archive 下载。
  2. 编辑 Shell 配置文件 .zshrc,添加 Maven 路径:
    export M2_HOME=/Users/chenwenshun/maven/apache-maven-3.6.3
    export PATH=$PATH:$M2_HOME/bin
    

6. 安装 IDE

从官网下载安装:

•	IntelliJ IDEA
•	PyCharm
•	Visual Studio Code

7. 安装 Python

第一步:安装 Python

从官网下载并安装 Python。

第二步:安装虚拟环境

  1. 安装 virtualenvwrapper:
pip install virtualenvwrapper
  1. 配置环境变量:
# 设置虚拟环境目录
echo 'export PATH=$PATH:~/.pyenv/versions/3.7.3/bin' >> .zshrc
echo 'export WORKON_HOME=~/.virtualenvs' >> .zshrc
echo 'mkdir -p $WORKON_HOME' >> .zshrc
echo 'source ~/.pyenv/versions/3.7.3/bin/virtualenvwrapper.sh' >> .zshrc
  1. 重新打开 Shell 窗口,一切就绪!

使用虚拟环境

  1. 进入开发工程目录,运行 workon,由于没有虚拟环境,显示为空。
  2. 创建新的虚拟环境:
mkvirtualenv temp
  1. 运行 workon,现在可以在 temp 环境下开发了。

8. 安装 Docker

从官网下载并安装 Docker。

9. 好用的免费小工具

•	Spectacle
•	iBar
•	Run cat
•	wrk
posted @ 2024-06-29 11:22  然_默  阅读(1)  评论(0编辑  收藏  举报