# 使用 Homebrew, apk, MacPorts, Nix 安装 nsh

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

## 安装

```sh
sudo av install brew:nsh
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install nsh
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install nsh
```

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

### Linux

- apk (92%):

```sh
sudo apk add nsh
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#nsh
```

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

## 软件包事实

- **软件包键:** brew:nsh
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/nsh>
- **版本:** 0.4.2
- **来源摘要:** Fish-like, POSIX-compatible shell
- **主页:** <https://github.com/nuta/nsh>
- **仓库:** <https://github.com/nuta/nsh>
- **许可证:** CC0-1.0 OR MIT
- **源码归档:** <https://github.com/nuta/nsh/archive/refs/tags/v0.4.2.tar.gz>
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- nsh (cli)
- nsh (别名)

## 构建依赖

- rust

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, catalina, monterey, sonoma, ventura

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.4.2
- 本地数据: OK
- 上游仓库: https://github.com/nuta/nsh
- 检测到的最新版本: v0.4.2 (当前)
- 信息: No package-manager update timestamp was available.
## 项目历史与用法

nsh is a Rust command-line shell that aims to combine fish-like interactive convenience with POSIX-compatible shell syntax and some Bash extensions. Its README lists tab completion, syntax highlighting, Bash completion support by invoking Bash internally, and zero-configuration interactive features.

### 项目历史

The GitHub repository was created on October 5, 2018, and the crates.io package was created on December 19, 2018. A Rust users forum announcement from December 17, 2018 framed the motivation as wanting fish-like out-of-the-box features while keeping traditional shell syntax and Bash scripting features.

### 采用历史

nsh is an experimental/alpha shell rather than a mainstream login shell. The README explicitly asks for help to make it practical for daily use and notes missing Bash features and likely bugs. Still, it drew developer interest: the GitHub repository had about 963 stars when queried on 2026-07-01, crates.io reported 33,186 total downloads and 20 versions, and Homebrew, MacPorts, Nix, and Alpine package it.

### 使用方式

Package users try it as an interactive shell with `nsh`, often via `cargo install nsh` or `brew install nsh`, to get completions and highlighting without adopting fish's non-POSIX language. The realistic usage is experimentation or personal shell sessions, not relying on it as `/bin/sh` for production scripts.

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

nsh sits in the recurring shell-design niche: keep Bourne/POSIX familiarity, borrow fish's interactive ergonomics, and implement it in Rust. For package catalogs it is best described as an interesting alternative shell with modest packaging footprint and alpha-stage caveats.

### 时间线

- 2018-10-05: GitHub repository created.
- 2018-12-17: author announced nsh on users.rust-lang.org.
- 2018-12-19: crates.io package created.
- 2021-07-21: crates.io metadata updated to version 0.4.2.
- 2023-02-11: GitHub repository pushed timestamp observed by API query.

### 来源

- <https://crates.io/crates/nsh>
- <https://formulae.brew.sh/api/formula/nsh.json>
- <https://github.com/macports/macports-ports/blob/master/shells/nsh/Portfile>
- <https://github.com/nuta/nsh>
- <https://users.rust-lang.org/t/nsh-a-command-line-shell-like-fish-but-aims-to-be-compatible-with-bash/23312>


## 安全说明

generalized runtime or code generation signal.

- **Geiger 风险:** yellow / 中
- generalized runtime or code generation signal

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** nsh
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## 其他软件包管理器记录

- Nix - nsh: normalized package name match | nixpkgs package indexes: pkgs/by-name/ns/nsh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - nsh - 0.4.2-r1: normalized package name match | Alpine Linux edge package indexes: nsh from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | A command-line shell like fish, but POSIX compatible | https://github.com/nuta/nsh
- apk - nsh-dbg - 0.4.2-r1: normalized package name match | Alpine Linux edge package indexes: nsh-dbg from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | A command-line shell like fish, but POSIX compatible (debug symbols) | https://github.com/nuta/nsh
- MacPorts - nsh: normalized package name match | MacPorts ports tree: shells/nsh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://pkg.so/zh-hans/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Language runtime packages](https://pkg.so/zh-hans/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [rust](https://pkg.so/zh-hans/brew/rust/) - Build dependency declared by Homebrew.
- [nushell](https://pkg.so/zh-hans/brew/nushell/) - Shares pkgdb curated category or tags: cli, rust, shell, system, terminal.
- [thefuck](https://pkg.so/zh-hans/brew/thefuck/) - Shares pkgdb curated category or tags: cli, shell, system, terminal.
- [dash-shell](https://pkg.so/zh-hans/brew/dash-shell/) - Shares pkgdb curated category or tags: cli, posix, shell, system.
- [brush](https://pkg.so/zh-hans/brew/brush/) - Shares pkgdb curated category or tags: cli, rust, shell, system.
- [murex](https://pkg.so/zh-hans/brew/murex/) - Shares pkgdb curated category or tags: cli, shell, system, terminal.
- [posh](https://pkg.so/zh-hans/brew/posh/) - Shares pkgdb curated category or tags: cli, posix, shell, system.
- [bash](https://pkg.so/zh-hans/brew/bash/) - Shares pkgdb curated category or tags: cli, shell, system.
- [elvish](https://pkg.so/zh-hans/brew/elvish/) - Shares pkgdb curated category or tags: cli, shell, system.
- [ansiweather](https://pkg.so/zh-hans/brew/ansiweather/) - Local package facts share a topical domain. Shared terms: cli, shell, system, terminal.
- [clifm](https://pkg.so/zh-hans/brew/clifm/) - Local package facts share a topical domain. Shared terms: cli, shell, system, terminal.

## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
