# 使用 Homebrew, Nix, zypper 安装 kubetrim

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

## 安装

```sh
sudo av install brew:kubetrim
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install kubetrim
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#kubetrim
```

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

- zypper (92%):

```sh
sudo zypper install kubetrim
```

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

## 软件包事实

- **软件包键:** brew:kubetrim
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/kubetrim>
- **版本:** 0.0.2
- **来源摘要:** Trim your KUBECONFIG automatically
- **主页:** <https://github.com/alexellis/kubetrim>
- **仓库:** <https://github.com/alexellis/kubetrim>
- **许可证:** MIT
- **源码归档:** <https://github.com/alexellis/kubetrim/archive/refs/tags/v0.0.2.tar.gz>
- **最后更新:** 2026-07-27T21:58:47+02:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- kubetrim (cli)
- kubetrim (别名)

## 构建依赖

- go

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.0.2
- 管理器更新时间: 2026-07-27
- 本地数据: OK
- 上游仓库: https://github.com/alexellis/kubetrim
- 检测到的最新版本: v0.0.2 (当前)
## 项目历史与用法

kubetrim is a small Alex Ellis utility for pruning stale Kubernetes contexts and clusters from a kubeconfig. It is a deliberately narrow CLI: load a kubeconfig, test contexts, and write back the entries that still work.

### 项目历史

The project appeared as a compact Go repository with a README centered on one job: tidying old and broken cluster and context entries. Its own Q&A compares the tool to doing the work manually with kubectl config commands and notes that kubectx removes contexts but leaves additional cleanup steps.

### 采用历史

kubetrim is niche but package-manager friendly: the batch input records Homebrew, Nix, and zypper packaging, and the README documents arkade and release downloads. That footprint is typical for Alex Ellis utilities that solve a recurring operator annoyance with a small binary.

### 使用方式

Users run kubetrim against the kubeconfig selected by KUBECONFIG, optionally use --write=false for a dry run, and can keep unreachable contexts by listing them in ~/.local/kubetrim/keep.txt. The README also suggests cron or shell startup usage for people who accumulate short-lived clusters.

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

kubetrim matters less as a broad Kubernetes platform and more as a tiny example of packageable operational hygiene. It wraps a manual, error-prone kubectl config cleanup routine into a single command with conservative behavior when every cluster appears unreachable.

### 时间线

- 2024: The repository copyright and release series show the tool as an Alex Ellis Go CLI.
- 2024: v0.0.1 added the keep-file mechanism for unreachable clusters that should not be deleted.
- 2024: v0.0.2 added a timeout when checking cluster contexts.

### Related projects

- Related tools include kubectl config, kubectx, arkade, k3sup, and other small Kubernetes operator utilities. kubetrim complements kubectx by cleaning both context and cluster entries after connectivity checks.

### 来源

- <https://formulae.brew.sh/formula/kubetrim>
- <https://github.com/alexellis/kubetrim>
- <https://github.com/alexellis/kubetrim/releases>


## 安全说明

narrow executable package without higher-risk signals.

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

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** kubetrim
- **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 - kubetrim: normalized package name match | nixpkgs package indexes: pkgs/by-name/ku/kubetrim/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- zypper - kubetrim - 0.0.1-1.9: normalized package name match | openSUSE Tumbleweed package metadata: kubetrim from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Trim your KUBECONFIG automatically | https://github.com/alexellis/kubetrim


## 相关链接

- [Cloud CLI packages](https://pkg.so/zh-hans/cloud-clis/) - Belongs to a cloud or infrastructure command family.
- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [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.
- [go](https://pkg.so/zh-hans/brew/go/) - Build dependency declared by Homebrew.
- [kconf](https://pkg.so/zh-hans/brew/kconf/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, configuration, kubeconfig, kubernetes.
- [qbec](https://pkg.so/zh-hans/brew/qbec/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [kor](https://pkg.so/zh-hans/brew/kor/) - Shares pkgdb curated category or tags: cleanup, cli, cloud-infrastructure, kubernetes.
- [naml](https://pkg.so/zh-hans/brew/naml/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [kubernetes-cli](https://pkg.so/zh-hans/brew/kubernetes-cli/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, kubernetes.
- [k9s](https://pkg.so/zh-hans/brew/k9s/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, kubernetes.
- [k3d](https://pkg.so/zh-hans/brew/k3d/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, kubernetes.
- [ctlptl](https://pkg.so/zh-hans/brew/ctlptl/) - Shares pkgdb curated category or tags: cli, cloud-infrastructure, kubernetes.

## Combined YAML source

View the package source record on GitHub. [combined/kubetrim.yml](https://github.com/mxcl/pkgdb/blob/main/combined/kubetrim.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
