# Install kubetrim with Homebrew, Nix, zypper

Trim your KUBECONFIG automatically. Version 0.0.2 via Homebrew; verified 2026-07-27. Also installable with nix: nix profile install nixpkgs#kubetrim.

## 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/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## Package facts

- **Package key:** brew:kubetrim
- **Package manager:** Homebrew
- **Version:** 0.0.2
- **Source summary:** Trim your KUBECONFIG automatically
- **Homepage:** <https://github.com/alexellis/kubetrim>
- **Repository:** <https://github.com/alexellis/kubetrim>
- **Last updated:** 2026-07-27T21:58:47+02:00
- **Generated:** 2026-08-03T19:37:03+00:00

## Executables

- kubetrim (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 0.0.2
## 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

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


## Combined YAML source

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


## Sources

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