MacBook 安装 Oh My Zsh 完整教程

新手友好版!命令可直接复制,插件提升终端效率,一步到位不踩坑~

一、安装 Homebrew

  • 官网下载

    bash 复制代码
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • 清华镜像(官网失败用)

    bash 复制代码
    /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

    选清华镜像,安装完重启终端。

  • 验证

    bash 复制代码
    brew -v

    (显示版本号即成功)

二、检查并安装 Zsh

Mac 自带 Zsh,查版本后按需安装:

  • 查版本:zsh --version

  • 无命令时安装:brew install zsh

三、安装 Oh My Zsh

  • 备份配置:cp ~/.zshrc ~/.zshrc.bak

  • 镜像安装(更稳)sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"出现完成提示即成功。

四、安装并配置核心插件

1. 安装插件(高亮+补全)

bash 复制代码
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

2. 启用插件

  1. 打开配置:open -e ~/.zshrc

  2. 找到 plugins=(git),改为:plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

  3. 保存关闭,生效:source ~/.zshrc

补充说明

  1. 原有 ~/.zshrc 自定义配置,手动加至新文件开头,避免变量丢失。

  2. 验证插件:ls 命令高亮,输入前缀显灰色补全建议。

相关推荐
aosky1 天前
手机远程畅玩OpenAI Codex
macos·智能手机·cocoa
A懿轩A1 天前
【2026 最新】Python 下载与安装:在 macOS 下使用 Homebrew 和 pyenv 完美管理多版本 Python
python·macos·mac
IKaros_α‌1 天前
mac上安装openclaw从入门到删除
macos
x-cmd1 天前
macOS 内存模型深度解析 | x free 设计哲学
linux·macos·内存·策略模式·free·x-cmd
itinymeng1 天前
在 macOS 上遇到 brew: command not found 错误,通常是因为 ‌Homebrew 未安装‌ 或 ‌PATH 环境变量未正确配置‌
macos
oscar9991 天前
Claude Code 的“计算机使用”功能:让命令行助手真正操控macOS桌面
macos·claude code·computer
老兵发新帖2 天前
软件开发国内常用镜像源配置及回退方法(MAC版)
macos·软件工程
HashFlag2 天前
Git经典锁报错问题
linux·windows·git·mac
qq_411262422 天前
ESP32-C5 软件配置MAC 地址
macos
鸠摩智首席音效师2 天前
如何在 MacOS 上安装 PostgreSQL ?
数据库·macos·postgresql