unixwin /niubash

AI-native bash for humans and AI agents: real bash syntax, real Unix commands (winuxcmd), real git via niu-git. Native Windows/Linux/Android/macOS/harmony - no WSL, no MSYS, no fork().

★ 304⑂ 16👁 0⑃ 603● 519▤ 50
RustMITCreated 2026-03-28unixwin.dev/products/niubash/
下载:Niubash v1.5.2Niubash-1.5.2 ↓1.5.22026-11-25
+2
日增长
304
stars
16
forks
0
watchers
603
prs
519
issues
50
releases

README

Niubash — 原生 Windows Bash(Git Bash alternative)

 真·Bash,Windows、Linux、macOS 原生构建。 不用 WSL,不开虚拟机,没有 /mnt/c,没有 cmdlet 方言。一个二进制:你手指肌肉记得的那个 shell,也是你 AI agent 天生会说的那个 shell。



English · 中文

文档与下载:unixwin.dev










安装 · Niubash vs Git Bash · 为什么不用 Git Bash / MSYS2 / Cygwin · AI agent · 兼容性与测试 · 性能 · 已知限制

niubash 是用 Rust 原生实现的 Bash 兼容 shell(Git Bash alternative)。在旗舰平台 Windows 上,一个 niu.exe 装下整个栈:

- rubash 语言引擎——GNU Bash 5.3 语义,无模拟层;
- 来自 WinuxCmd 的真 Unix 命令,为 shell 使用设计的原生构建;
- 带 git 状态的 prompt,与带权限模型的插件系统;
- 还有 git 本体:niu-git 是用 MSVC 构建的 git-for-windows 真 C 源码,PATH 上的 git 就是 git 本身——没有 MSYS 运行时,没有启动器跳板,不带 perl。git 的 shell 脚本部分(hooks、git bisect、git mergetool)跑在 niubash 自己的 sh 上。

从 niu 会话启动的 agent 会经 SHELL 继承它作为 shell;哪些 agent 跑什么 shell、怎么把其余的指过来,Coding agents on Windows 逐个写明。Linux 与 macOS 构建是便携 niu 二进制,直接用系统自带的工具。

niu 不是 MSYS2、Cygwin、Git Bash,也不是 WSL——没有 POSIX 模拟层,也没有启发式的路径转换。它是 Git Bash 的 from-scratch replacement:原生 Windows 二进制。每个平台的完整契约(包括每个目标的诚实状态)见 platform-support.md。


  


同一组命令,两种下场——Git Bash 的 MSYS 层对比 niu,并排实录。点图片看动图版(assets/demo-gitbash.gif)。

 快速开始

下载统一从 unixwin.dev 进入。最新版本:v1.5.0(2026-11-03;最新构建始终在 Releases 页)。

Windows(winget,1.5.0):

powershell
winget install --id Unixwin.Niubash


Windows(Scoop,1.5.0,便携 zip,niu 由 scoop shim 上 PATH;scoop update niubash 跟随发行版):Extras 仓库的提交(ScoopInstaller/Extras19334)正在审核,合并后即可 scoop bucket add extras 再 scoop install niubash。合并前可直接用仓内参考 manifest 安装:

powershell
scoop install https://raw.githubusercontent.com/unixwin/niubash/master/installer/scoop/niubash.json


Windows(安装器):去 Releases 下载 niubash-v-win--setup.exe 双击——不要管理员权限,PATH 和 Windows Terminal 配置自动配好。要便携版就拿 .tar.gz(tar -xf niubash-v-win-x64.tar.gz,Windows 10+ 自带)——解包时还原捆绑 git/awk 载荷的硬链接,解出来的目录和 wpm 安装一样小。.7z 下载最小(solid 压缩),但它存的是重复载荷内容而非链接,解出来体积更大。.zip 只留给除 zip 什么都不认的工具链:它存不了硬链接,载荷被重复存放,包大得多。

Linux(apt,x86_64 / aarch64;Ubuntu 22.04+、Debian 12+):

sh
curl -fsSL https://unixwin.github.io/apt/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/niubash-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/niubash-archive-keyring.gpg] https://unixwin.github.io/apt stable main" | sudo tee /etc/apt/sources.list.d/niubash.list
sudo apt update && sudo apt install niubash


归档自动跟随发布(发布后数小时内收录;gh workflow run build-apt -R unixwin/apt 可立即触发)。只装 /usr/bin/niu,不动系统 bash 和 coreutils。

Linux(x86_64、aarch64;glibc 2.35+)与 macOS(aarch64、x86_64):拿便携 tarball,解包即跑:

sh
tar -xzf niubash-v-linux-x86_64.tar.gz && niubash-v-linux-x86_64/niu


Android(aarch64、armv7):v1.4.3 起 release 自带 .zip,真机(Termux)可运行——各平台的诚实状态见平台支持。

源码构建(Rust 1.95+):
git clone https://github.com/unixwin/niubash.git && cd niubash && cargo build --release

配置只有一个文件:~/.niubashrc,纯 Bash 语法——它是 niu 在 Windows 上唯一读取的启动文件。Linux/macOS 的登录 shell 额外读 GNU profile 链(/etc/profile,然后 ~/.bash_profile → ~/.bash_login → ~/.profile 取第一个存在的),与 GNU bash 完全一致;~/.bashrc 永不被直接 source(niu plugin migrate-rc --diff 会告诉你哪些东西值得搬过来)——从快速上手开始。

 首跑实测

console
$ niu --version
Niubash 1.5.0 — bash-compatible shell for Window

Top issues

Latest release

Niubash v1.5.2 v1.5.2 2026-11-25
Niubash v1.5.2 packages for Windows, Linux, and macOS.

Engine: rubash git d63287553235 — every platform build in this release compiled that same revision, pinned by scripts/release/rubash-pin.json and fail-hard verified at fetch time (rubash827). The release compiles the pinned engine, not "whatever rubash master was when the pipeline ran".
Verify locally with niu --version, which prints the same revision.

Windows (x64, ARM64): Inno Setup installers (-setup.exe) add user PATH and Windows Terminal profile integration; portable archives bundle niu with WinuxCmd and bash/sh shims.

Portable dow

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON