# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper 安装 zsh

查看 zsh 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:zsh
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install zsh
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install zsh
```

  证据: MacPorts ports tree: shells/zsh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add zsh
```

  证据: Alpine Linux edge package indexes: zsh from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install zsh
```

  证据: Debian stable package indexes: zsh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install zsh
```

  证据: Fedora Rawhide package metadata: zsh from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#zsh
```

  证据: nixpkgs package indexes: pkgs/by-name/zs/zsh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S zsh
```

  证据: Arch Linux sync databases: zsh from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install zsh
```

  证据: openSUSE Tumbleweed package metadata: zsh from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:zsh
- **软件包管理器:** Homebrew
- **版本:** 5.9.2
- **来源摘要:** UNIX shell (command interpreter)
- **主页:** <https://www.zsh.org/>
- **最后更新:** 2026-07-12T21:49:02Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- zsh (别名)
- zsh-5.9.2 (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 5.9.2
## 项目历史与用法

Zsh is one of the major Unix command interpreters: Bourne-like enough for daily shell work, but famous for interactive features such as programmable completion, spelling correction, glob qualifiers, prompt expansion, modules, line editing, and extensive startup-file control.

### 项目历史

Zsh was originally written by Paul Falstad while he was a Princeton student, and the official FAQ preserves the name origin as 'Z shell' after Yale professor Zhong Shao. The project started around 1990 and entered the public Unix shell ecosystem in the early 1990s as a more featureful interactive shell than sh, csh, and ksh users typically had by default.

The shell matured through the 1990s with mailing-list-driven development, a large manual, and a compatibility stance that mixed Bourne-shell scripting with deliberately non-minimal interactive features. The official documentation still reflects that breadth: shell grammar, parameters, expansion, completion, modules, ZLE widgets, TCP helpers, calendar functions, and many option switches are documented as first-class parts of the system.

The 4.x series established zsh as a stable power-user shell, while the 5.x series modernized a codebase already common on Unix-like systems. The official news page records zsh 5.0.0 in 2012 and zsh 5.9 in 2022, showing a project that is conservative in release cadence but still maintained.

Apple's macOS Catalina changed zsh's public profile. In 2019 Apple documented that the default interactive shell changed from bash to zsh, turning a shell long associated with Unix enthusiasts into the out-of-box shell for new macOS user accounts.

### 采用历史

Before the macOS switch, zsh adoption was strongest among Unix developers, sysadmins, and shell customizers who valued completion and prompt control. Frameworks such as Oh My Zsh later made that culture visible by collecting themes, plugins, and conventions around `.zshrc` customization.

After macOS Catalina, zsh became a default shell for a large population of developers using Macs. That did not make every user a zsh power user, but it changed packaging expectations: plugins, completions, prompt themes, history tools, and shell integrations increasingly treated zsh as a baseline target next to bash.

Distribution packaging is broad. The input package facts list zsh across Homebrew, Debian, Ubuntu, Fedora, Arch, openSUSE, MacPorts, Nix, and Alpine-related packages, reflecting its role as infrastructure rather than a niche optional tool.

### 使用方式

Interactive users configure zsh through its startup-file sequence: `.zshenv`, `.zprofile`, `.zshrc`, `.zlogin`, and `.zlogout`. `.zshrc` is the common home for aliases, prompt setup, completion initialization, key bindings, plugin loading, and history behavior.

Developers use zsh as a login shell, an interactive command interpreter, and sometimes a scripting language when zsh-specific expansion, arrays, globbing, or modules are useful. Its completion system is a major practical draw: package managers and CLIs often ship zsh completion definitions because zsh users expect rich argument completion.

The shell is also the substrate for a large plugin ecosystem: prompt frameworks, autosuggestions, syntax highlighting, fuzzy history, directory jumping, and language-toolchain helpers are commonly loaded from `.zshrc`.

### 为什么软件包爱好者会关心

zsh is package-nerd royalty because it is both a package and a platform for other packages. A package database can list zsh as a command interpreter, but its real ecosystem includes completions, plugins, prompt themes, framework packages, and tools that exist only because zsh's extension points are useful.

It is also a clean example of how defaults change package importance. zsh was already old and respected before macOS Catalina; Apple's default-shell switch made it newly central to developer workstations, Homebrew instructions, dotfile repos, and shell-plugin packaging.

For curation, zsh should be connected not just to shells such as bash, ksh, fish, and tcsh, but also to package-manager completion systems and interactive terminal UX tools.

### 时间线

- 1990: Paul Falstad begins the shell that becomes zsh.
- 1990s: zsh develops as a feature-rich Bourne-style Unix shell with programmable completion and ZLE editing.
- 2009: Oh My Zsh is created, helping popularize plugin-and-theme based zsh customization.
- 2012-07-24: zsh 5.0.0 is released, according to the official zsh news archive.
- 2019-10-07: macOS Catalina is released, and Apple documents zsh as the default shell for new user accounts.
- 2022-05-14: zsh 5.9 is released, according to the official zsh news archive.

### Related projects

- Related projects include bash, ksh, tcsh, fish, Oh My Zsh, Prezto, antigen, zinit, zplug, starship, powerlevel10k, zsh-completions, zsh-autosuggestions, zsh-syntax-highlighting, and zsh-history-substring-search.

### 来源

- <https://github.com/ohmyzsh/ohmyzsh>
- <https://sourceforge.net/p/zsh/code/>
- <https://support.apple.com/en-us/102360>
- <https://www.zsh.org/>
- <https://zsh.sourceforge.io/Doc/>
- <https://zsh.sourceforge.io/FAQ/zshfaq01.html>
- <https://zsh.sourceforge.io/News/>


## 安全说明

doc example: shell runtime.

- **Geiger 风险:** yellow / 高
- doc example: shell runtime


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.zshenv, ~/.zprofile, ~/.zshrc, ~/.zlogin, ~/.zlogout

## Credential files

- Unix: ~/.zshenv, ~/.zprofile, ~/.zshrc, ~/.zlogin, ~/.zlogout
## 其他软件包管理器记录

- Debian apt - zsh - 5.9-8+b23: normalized package name match | Debian stable package indexes: zsh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | shell with lots of features | https://www.zsh.org/
- Debian apt - zsh-common - 5.9-8: normalized package name match | Debian stable package indexes: zsh-common from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | architecture independent files for Zsh | https://www.zsh.org/
- Debian apt - zsh-dev - 5.9-8+b23: normalized package name match | Debian stable package indexes: zsh-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | shell with lots of features (development files) | https://www.zsh.org/
- Debian apt - zsh-doc - 5.9-8: normalized package name match | Debian stable package indexes: zsh-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | zsh documentation - info/HTML format | https://www.zsh.org/
- Debian apt - zsh-static - 5.9-8+b23: normalized package name match | Debian stable package indexes: zsh-static from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | shell with lots of features (static link) | https://www.zsh.org/
- Nix - zsh: normalized package name match | nixpkgs package indexes: pkgs/by-name/zs/zsh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - zsh - 5.9-6ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: zsh from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | shell with lots of features | https://www.zsh.org/
- Ubuntu apt - zsh-common - 5.9-6ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: zsh-common from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | architecture independent files for Zsh | https://www.zsh.org/
- Ubuntu apt - zsh-dev - 5.9-6ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: zsh-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | shell with lots of features (development files) | https://www.zsh.org/
- Ubuntu apt - zsh-doc - 5.9-6ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: zsh-doc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | zsh documentation - info/HTML format | https://www.zsh.org/
- Ubuntu apt - zsh-static - 5.9-6ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: zsh-static from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | shell with lots of features (static link) | https://www.zsh.org/
- apk - android-tools-zsh-completion - 5.9-r7: normalized package name match | Alpine Linux edge package indexes: android-tools-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Zsh completions for android-tools | https://www.zsh.org/
- apk - bzr-zsh-completion - 5.9-r7: normalized package name match | Alpine Linux edge package indexes: bzr-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Zsh completions for bzr | https://www.zsh.org/
- apk - composer-zsh-completion - 5.9-r7: normalized package name match | Alpine Linux edge package indexes: composer-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Zsh completions for composer | https://www.zsh.org/
- apk - cvs-zsh-completion - 5.9-r7: normalized package name match | Alpine Linux edge package indexes: cvs-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Zsh completions for cvs | https://www.zsh.org/
- apk - gcc-zsh-completion - 5.9-r7: normalized package name match | Alpine Linux edge package indexes: gcc-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Zsh completions for gcc | https://www.zsh.org/


## Combined YAML source

View the package source record on GitHub. [combined/zsh.yml](https://github.com/mxcl/pkgdb/blob/main/combined/zsh.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
