# Install kubectx with Homebrew

Tool that can switch between kubectl contexts easily and create aliases. Version 0.11.0 via Homebrew; verified 2026-07-27.

## Install

```sh
sudo av install brew:kubectx
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install kubectx
```

  Evidence: provider-native install command

## Package facts

- **Package key:** brew:kubectx
- **Package manager:** Homebrew
- **Version:** 0.11.0
- **Source summary:** Tool that can switch between kubectl contexts easily and create aliases
- **Homepage:** <https://github.com/ahmetb/kubectx>
- **Repository:** <https://github.com/ahmetb/kubectx>
- **Last updated:** 2026-07-27T21:58:45+02:00
- **Generated:** 2026-08-03T00:40:33+00:00

## Executables

- kubectl-ctx (alias)
- kubectl-ns (alias)
- kubectx (alias)
- kubens (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 0.11.0
## Project history and usage

kubectx is a small Kubernetes command-line companion that packages two everyday workflow shortcuts: switching kubeconfig contexts with kubectx and switching namespaces with kubens. It became a widely installed kubectl-adjacent utility because it solves a repetitive operator problem without introducing a larger cluster-management framework.

### Project history

The public GitHub repository was created on March 30, 2017, and the v0.1 release was published on April 25, 2017. The original project was shell-oriented; later releases added a Go implementation while retaining the simple command names and shell-completion focused workflow.

The README describes the package as 'Power tools for kubectl' and positions kubectx for faster cluster/context changes and kubens for namespace changes. That pairing made the project fit naturally beside kubectl rather than replacing it.

### Adoption history

kubectx spread through multiple packaging ecosystems because it is useful on every workstation that touches more than one Kubernetes cluster. The official README documents installation through Homebrew, MacPorts, apt, pacman, Chocolatey, Scoop, winget, and Krew, which reflects cross-platform adoption by both Kubernetes operators and developers.

Its inclusion as Krew plugins named ctx and ns gave it a Kubernetes-native installation path, while Homebrew and Linux distribution packages made it familiar to package-manager users outside the Kubernetes plugin index.

### How it is used

kubectx reads the user's kubeconfig contexts and switches the active context, including a shortcut for returning to the previous context. kubens similarly updates the namespace on the active context. Optional fzf integration adds interactive selection for long cluster and namespace lists.

The tool is commonly paired with shell completions and prompt helpers such as kube-ps1 or oh-my-posh so operators can both switch context quickly and see the selected cluster or namespace before running kubectl commands.

### Why package nerds care

kubectx is a package-nerd staple because it is tiny, scriptable, and heavily repackaged: one upstream repository feeds native OS package managers, Windows package managers, and Krew. It is also a good example of a CLI whose adoption comes from reducing command friction rather than adding a new control plane.

### Timeline

- 2017-03-30: Public GitHub repository created
- 2017-04-25: v0.1 release published
- 2021-07-06: v0.9.4 release published after the project had become a common kubectl companion
- 2026-03-27: v0.11.0 release published

### Related projects

- kubens is shipped from the same repository and handles namespace switching.
- Krew distributes kubectx and kubens as kubectl plugins named ctx and ns.
- fzf is an optional dependency for interactive context and namespace selection.
- kube-ps1 and oh-my-posh are prompt tools the README recommends for displaying Kubernetes context.

### Sources

- <https://api.github.com/repos/ahmetb/kubectx>
- <https://formulae.brew.sh/formula/kubectx>
- <https://github.com/ahmetb/kubectx>
- <https://github.com/ahmetb/kubectx/releases>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- 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: ~/.kube/config

## Combined YAML source

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


## Sources

- Nucleus package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
