# Install kubetrim with Homebrew, Nix, zypper

Trim your KUBECONFIG automatically. Version 0.0.2 via Homebrew; verified from local package data.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install kubetrim
```

  Evidence: local Homebrew formula metadata

### Linux

- Nix (92%):

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

  Evidence: 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
```

  Evidence: openSUSE Tumbleweed package metadata: kubetrim from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

## Package facts

- **Package key:** brew:kubetrim
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/kubetrim>
- **Version:** 0.0.2
- **Source summary:** Trim your KUBECONFIG automatically
- **Homepage:** <https://github.com/alexellis/kubetrim>
- **Repository:** <https://github.com/alexellis/kubetrim>
- **Upstream docs:** <https://github.com/alexellis/kubetrim#readme>
- **License:** MIT
- **Source archive:** <https://github.com/alexellis/kubetrim/archive/refs/tags/v0.0.2.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- kubetrim (cli)
- kubetrim (alias)

## Build dependencies

- go

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.0.2
- Local data: ok
- Upstream repository: https://github.com/alexellis/kubetrim
- Upstream latest detected: v0.0.2 (current)
- info: No package-manager update timestamp was available.
## Project history and usage

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.

### Project history

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.

### Adoption history

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.

### How it is used

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.

### Why package nerds care

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.

### Timeline

- 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.

### Sources

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


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

- **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

## Other Package-Manager Records

- 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.6: normalized package name match | openSUSE Tumbleweed package metadata: kubetrim from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Trim your KUBECONFIG automatically | https://github.com/alexellis/kubetrim


## Related links

- [Cloud CLI packages](https://www.automicvault.com/pkg/cloud-clis/) - Belongs to a cloud or infrastructure command family.
- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [go](https://www.automicvault.com/pkg/brew/go/) - Build dependency declared by Homebrew.
- [kconf](https://www.automicvault.com/pkg/brew/kconf/) - Shares av.db curated category or tags: cli, cloud-infrastructure, configuration, kubeconfig, kubernetes.
- [qbec](https://www.automicvault.com/pkg/brew/qbec/) - Shares av.db curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [kor](https://www.automicvault.com/pkg/brew/kor/) - Shares av.db curated category or tags: cleanup, cli, cloud-infrastructure, kubernetes.
- [naml](https://www.automicvault.com/pkg/brew/naml/) - Shares av.db curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [tanka](https://www.automicvault.com/pkg/brew/tanka/) - Shares av.db curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [vals](https://www.automicvault.com/pkg/brew/vals/) - Shares av.db curated category or tags: cli, cloud-infrastructure, configuration, kubernetes.
- [cdk8s](https://www.automicvault.com/pkg/brew/cdk8s/) - Shares av.db curated category or tags: cli, cloud-infrastructure, kubernetes.
- [chaoskube](https://www.automicvault.com/pkg/brew/chaoskube/) - Shares av.db curated category or tags: cli, cloud-infrastructure, kubernetes.

## Combined YAML source

View the package source record on GitHub. [combined/kubetrim.yml](https://github.com/automic-vault/db/blob/main/combined/kubetrim.yml)


## Sources

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