macOS 利器清单

前言 #

这篇文章更偏向于全面性的清单,简单的将电脑上安装的应用分为以下几个大类:

  • 基础&系统辅助。例如 Homebrew、输入法、快捷键配置工具、网络工具
  • Emacs 相关。把 Emacs 相关的单独提出来
  • 命令行工具。例如 wget、axel、mosh、vim
  • 日常软件。例如微信、浏览器、音乐播放器、视频播放器
  • 工作用专业软件。例如软件开发、项目管理、视频剪辑

本文是汇总使用的软件,并且在文章末尾提供了软件备份和一键安装的方式。

安装 Homebrew 包管理 #

可以说是 macOS 上的 App 包管理器

使用国内镜像安装 #

这一步在全新系统上安装时特别有用,因为网络限制很可能是无法顺利安装 Homebrew 的。 此时需要先使用国内镜像把 Homebrew 安装上,再去配置好网络。

配置环境变量

如果使用 zsh,则将以下内容追加到 ~/.zprofile

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"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

安装 Homebrew

以下命令时将安装脚本下载下来再执行。

git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh

将 brew 命令加入到环境变量

test -r ~/.bash_profile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
test -r ~/.zprofile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

使用原版安装方法 #

xcode-select –install

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

常见 Homebrew 使用命令 #

搜索软件

brew search xxx

安装

brew install xxx

安装 GUI 界面的软件

brew install --cask xxx

卸载软件

brew uninstall xxx

安装基础软件 #

# Rime input method engine
cask "squirrel"
# Desktop automation application
cask "hammerspoon"
# Application launcher and productivity software
cask "alfred"
# Keyboard customiser
cask "karabiner-elements"
# Password manager app
cask "keepassxc"
# File archiver
cask "keka"
# Network toolbox
cask "surge"

Emacs 相关 #

tap "d12frosted/emacs-plus"
# GNU Emacs text editor
brew "d12frosted/emacs-plus/emacs-plus@30", args: ["with-imagemagick", "with-modern-alecive-flatwoken-icon", "with-native-comp", "with-poll", "with-xwidgets"]

安装 Doom Emacs

git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom install

拉上自己的配置文件

git clone git@github.com:nailuoGG/doom-emacs-conf.git ~/.config/doom

同步配置

doom sync && doom build && doom doctor

Emacs 中的一些常见的环境变量配置

命令行工具 #

# Command Line Tools
brew "aria2" # Download with resuming and segmented downloading
brew "aspell" # Spell checker with better logic than ispell
brew "axel" # Light UNIX download accelerator
brew "cmake" # Cross-platform make
brew "coreutils" # GNU File, Shell, and Text utilities
brew "deno" # Secure runtime for JavaScript and TypeScript
brew "fd" # Simple, fast and user-friendly alternative to find
brew "ffmpeg" # Play, record, convert, and stream audio and video
brew "findutils" # Collection of GNU find, xargs, and locate
brew "git" # Distributed revision control system
brew "git-lfs" # Git extension for versioning large files
brew "gnupg" # GNU Pretty Good Privacy (PGP) package
brew "htop" # Improved top (interactive process viewer)
brew "hugo" # Configurable static site generator
brew "jenv" # Manage your Java environment
brew "mosh" # Remote terminal application
brew "neovim" # Ambitious Vim-fork focused on extensibility and agility
brew "openjdk" # Development kit for the Java programming language
brew "pinentry-mac" # Pinentry for GPG on Mac
brew "pipenv" # Python dependency management tool
brew "pngpaste" # Paste PNG into files
brew "portaudio" # Cross-platform library for audio I/O
brew "ripgrep" # Search tool like grep and The Silver Searcher
brew "rust-analyzer" # Experimental Rust compiler front-end for IDEs
brew "shellcheck" # Static analysis and lint tool, for (ba)sh scripts
brew "spaceship" # Zsh prompt for Astronauts
brew "tmux" # Terminal multiplexer
brew "wget" # Internet file retriever
brew "yt-dlp" # Fork of youtube-dl with additional features and fixes
brew "zsh" # UNIX shell (command interpreter)
brew "zsh-autosuggestions" # Fish-like fast/unobtrusive autosuggestions for zsh
brew "zsh-syntax-highlighting" # Fish shell like syntax highlighting for zsh
cask "gpgfrontend" # OpenPGP/GnuPG crypto, sign and key management tool

安装后配置

切换 shell 为 Homebrew 版本的 zsh

# 添加从Homebrew上安装的shell到/etc/shells
sudo vim /etc/shells
# 在最后一行添加 /opt/homebrew/bin/zsh
# 使用chsh切换当前用户的SHELL
chsh -s /opt/homebrew/bin/zsh

如果报错:chsh: /opt/homebrew/bin/zsh: non-standard shell

说明/opt/homebrew/bin/zsh 不在合法的 shell 列表中,请将其添加到/etc/shells 文件中。

切换完成后,需要注销后重新登录或者开启新的会话。

为什么要切换?因为系统自带版本的是架构不一样

➜ /bin/zsh --version
/bin/zsh --version
zsh 5.9 (x86_64-apple-darwin23.0)
➜ /opt/homebrew/bin/zsh --version
/opt/homebrew/bin/zsh --version
zsh 5.9 (arm-apple-darwin23.0.0)

安装日常软件 #

# Everyday Applications
mas "Drafts", id: 1435957248
mas "Just Focus", id: 1142151959
mas "微信", id: 836500024
cask "anki" # Memory training application
cask "arc" # Chromium based browser
cask "chatbox" # Desktop app for GPT-4 / GPT-3.5 (OpenAI API)
cask "firefox" # Web browser
cask "google-chrome" # Web browser
cask "iina" # Free and open-source media player
cask "keepassxc" # Password manager app
cask "keka" # File archiver
cask "neteasemusic" # Music streaming platform
cask "ollama" # Get up and running with large language models locally
cask "ppduck" # Integrates several image compression algorithms
cask "spacedrive" # Open source cross-platform file explorer
cask "spotify" # Music streaming service
cask "surge" # Network toolbox
cask "telegram" # Messaging app with a focus on speed and security
cask "whisky" # Wine wrapper built with SwiftUI
cask "xmind" # Mind mapping and brainstorming tool

安装专业软件 #

专业软件指完成特定任务,如编程、视频剪辑、教程录制、学习技术等等事项所需的软件。或者说更加偏向具体工作的软件。

# Professional Software
cask "xmind" # Mind mapping and brainstorming tool
mas "钉钉", id: 1435447041 # 公司用钉钉
mas "Xcode", id: 497799835 # 开发iOS、macOS软件必备
mas "DevHub" # GitHub notifications and activities manager
mas "Drafts" # Quick capture and workflow automation
mas "iMovie 剪辑" # Video editing software
mas "Keynote 讲演" # Presentation software
mas "Numbers 表格" # Spreadsheet software
mas "Pages 文稿" # Word processing software
mas "Things" # Task management software
mas "Xcode" # Development environment for macOS
mas "富途牛牛" # Trading and investment platform
mas "库乐队" # Music creation software

尝鲜体验 #

指并没有纳入日常使用流程,但是在某些方面具备优势,值得尝试一下。

mas "OpenCat" # Coding and automation for Bittle robot dog
cask "zed" # Multiplayer code editor

备份和批量安装脚本 #

备份&安装脚本 #

#!/bin/bash

# 定义备份文件名
BACKUP_FILE="Brewfile"

# 功能:执行备份
backup() {
    echo "正在备份..."
    # 备份 Homebrew、Homebrew Cask 和 MAS 安装的程序
    brew bundle dump --describe --force --file="$BACKUP_FILE"
    echo "备份完成,文件保存为 $BACKUP_FILE"
}

# 功能:执行安装
install() {
    echo "正在根据 $BACKUP_FILE 文件安装程序..."
    if [ -f "$BACKUP_FILE" ]; then
        brew bundle --file="$BACKUP_FILE"
        echo "安装完成。"
    else
        echo "错误:备份文件 $BACKUP_FILE 不存在。"
    fi
}

# 主脚本开始
# 检查用户输入
if [ "$#" -ne 1 ]; then
    echo "使用方法:$0 <backup|install>"
    exit 1
fi

# 根据用户选择执行功能
case "$1" in
    backup)
        backup
        ;;
    install)
        install
        ;;
    *)
        echo "无效的选项:$1"
        echo "使用方法:$0 <backup|install>"
        exit 2
        ;;
esac

脚本使用方法 #

下载备份脚本 brew_backup_install.sh

wget http://wiki.liujiale.me/shell/brew_backup_install.sh

备份当前使用 Homebrew、mas 安装的所有应用清单

bash brew_backup_install.sh backup

备份文件会放在当前目录下

➜ tree
.
├── Brewfile
└── brew_backup_install.sh

1 directory, 2 files

批量安装经过备份的脚本

bash brew_backup_install.sh install

以上是一次性安装所有的脚本,其实也可以分开分步骤安装

小结 #

本文按照软件在系统中的层级,列举出了我常用的软件的清单。当然这也包含了一些出于好奇而安装的软件。但是总的来说也提现了个人的工作和生活需求,是自己数字工具的一部分。

如果未来想要一键安装本文提到的软件,可以使用以下安装脚本