# 使用 Homebrew, apt, MacPorts, Nix 安装 ondir

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

## 安装

```sh
sudo av install brew:ondir
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install ondir
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install ondir
```

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

### Linux

- Debian apt (92%):

```sh
sudo apt install ondir
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#ondir
```

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

## 软件包事实

- **软件包键:** brew:ondir
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/ondir>
- **版本:** 0.2.4
- **来源摘要:** Automatically execute scripts as you traverse directories
- **主页:** <https://swapoff.org/ondir.html>
- **仓库:** <https://github.com/alecthomas/ondir>
- **上游文档:** <https://swapoff.org/ondir.html>
- **许可证:** GPL-2.0-or-later
- **源码归档:** <https://swapoff.org/files/ondir/ondir-0.2.4.tar.gz>
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- ondir (cli)
- ondir (别名)

## 安装行为

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

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.2.4
- 本地数据: OK
- 上游仓库: https://swapoff.org/ondir.html
- 信息: No package-manager update timestamp was available.
- 信息: Release/tag comparison is only available for GitHub repositories.
## 项目历史与用法

OnDir is a small terminal automation utility for running directory-specific shell actions when a user enters, leaves, or passes through configured paths. Its core idea is deliberately narrow: pair shell startup hooks with entries in ~/.ondirrc so path traversal can change process-local state such as umask values, environment setup, or virtualenv activation.

### 项目历史

The upstream documentation presents OnDir as a compact C and shell tool by Alec Thomas, with source tarballs from 0.1.0 through 0.2.2 published on the project page and a mirrored GitHub repository containing the README, man page, shell hooks, and configuration examples. The project stayed small by design; the README describes the behavior as simple but effective.

### 使用方式

Users install shell hooks for Bash, tcsh, zsh, or fish and then define enter and leave sections in ~/.ondirrc. The examples cover a public_html umask change, multiple paths per section, tilde and environment-variable expansion, regular-expression path matching, and automatic activation or deactivation of Python virtual environments.

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

OnDir is an early Unix-style answer to per-directory environment automation: tiny, text-configured, and shell-integrated rather than a large daemon. For package nerds, it is interesting less for scale than for how long the directory-hook pattern has been packaged as a standalone CLI.

### Related projects

- The project sits in the same conceptual space as shell prompt hooks and per-directory environment tools, but its implementation is limited to running configured scripts during directory traversal.

### 来源

- <https://formulae.brew.sh/formula/ondir>
- <https://github.com/alecthomas/ondir>
- <https://swapoff.org/ondir.html>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## 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: ~/.ondirrc
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** ondir
- **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

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

- Debian apt - ondir - 0.2.3+git20140220.55279f0-1: normalized package name match | Debian stable package indexes: ondir from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Automate tasks specific to certain directories in the shell | https://swapoff.org/ondir.html
- Nix - ondir: normalized package name match | nixpkgs package indexes: pkgs/by-name/on/ondir/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - ondir - 0.2.3+git0.55279f03-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: ondir from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Automate tasks specific to certain directories in the shell | http://swapoff.org/ondir.html
- MacPorts - ondir: normalized package name match | MacPorts ports tree: sysutils/ondir/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://pkg.so/zh-hans/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [powershell](https://pkg.so/zh-hans/brew/powershell/) - Shares pkgdb curated category or tags: automation, cli, developer-tools, shell.
- [parallel](https://pkg.so/zh-hans/brew/parallel/) - Shares pkgdb curated category or tags: automation, cli, developer-tools, shell.
- [shellcheck](https://pkg.so/zh-hans/brew/shellcheck/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [fish](https://pkg.so/zh-hans/brew/fish/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [shfmt](https://pkg.so/zh-hans/brew/shfmt/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [sheldon](https://pkg.so/zh-hans/brew/sheldon/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [shellspec](https://pkg.so/zh-hans/brew/shellspec/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [mcfly](https://pkg.so/zh-hans/brew/mcfly/) - Shares pkgdb curated category or tags: cli, developer-tools, shell.
- [shunit2](https://pkg.so/zh-hans/brew/shunit2/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, scripts, shell.

## Combined YAML source

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


## 来源

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