# Install kubectx with Homebrew, apk, chocolatey, apt, MacPorts, Nix, pacman, scoop, winget, zypper

Tool that can switch between kubectl contexts easily and create aliases. Version 0.11.0 via Homebrew; verified from local package data.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install kubectx
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install kubectx
```

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

### Linux

- apk (92%):

```sh
sudo apk add kubectx
```

  Evidence: Alpine Linux edge package indexes: kubectx from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install kubectx
```

  Evidence: Debian stable package indexes: kubectx from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#kubectx
```

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

- pacman (92%):

```sh
sudo pacman -S kubectx
```

  Evidence: Arch Linux sync databases: kubectx from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install kubectx
```

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

### Windows

- Chocolatey (92%):

```sh
choco install kubectx
```

  Evidence: Chocolatey community package catalog: kubectx from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','kb5001567'

- Scoop (92%):

```sh
scoop install main/kubectx
```

  Evidence: Scoop official bucket manifest trees: bucket/kubectx.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id ahmetb.kubectx -e
```

  Evidence: Windows Package Manager source index: ahmetb.kubectx from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:kubectx
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/kubectx>
- **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>
- **Upstream docs:** <https://github.com/ahmetb/kubectx#readme>
- **License:** Apache-2.0
- **Source archive:** <https://github.com/ahmetb/kubectx/archive/refs/tags/v0.11.0.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- kubectl-ctx (cli)
- kubectl-ns (cli)
- kubectx (cli)
- kubens (cli)
- kubectl-ctx (alias)
- kubectl-ns (alias)
- kubectx (alias)
- kubens (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.11.0
- Local data: ok
- Upstream repository: https://github.com/ahmetb/kubectx
- Upstream latest detected: v0.11.0 (current)
- info: No package-manager update timestamp was available.
## 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
## Source Database Details

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

- Debian apt - kubectx - 0.9.5-2+b10: normalized package name match | Debian stable package indexes: kubectx from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Fast way to switch between clusters and namespaces in kubectl | https://github.com/ahmetb/kubectx
- Nix - kubectx: normalized package name match | nixpkgs package indexes: pkgs/by-name/ku/kubectx/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - kubectx - 0.9.5-1: normalized package name match | Ubuntu 24.04 LTS package indexes: kubectx from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Fast way to switch between clusters and namespaces in kubectl | https://github.com/ahmetb/kubectx
- apk - kubectx - 0.11.0-r2: normalized package name match | Alpine Linux edge package indexes: kubectx from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Faster way to switch between clusters and namespaces in kubectl | https://kubectx.dev/
- apk - kubectx-bash-completion - 0.11.0-r2: normalized package name match | Alpine Linux edge package indexes: kubectx-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Bash completions for kubectx | https://kubectx.dev/
- apk - kubectx-fish-completion - 0.11.0-r2: normalized package name match | Alpine Linux edge package indexes: kubectx-fish-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Fish completions for kubectx | https://kubectx.dev/
- apk - kubectx-zsh-completion - 0.11.0-r2: normalized package name match | Alpine Linux edge package indexes: kubectx-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for kubectx | https://kubectx.dev/
- pacman - kubectx - 0.11.0-1: normalized package name match | Arch Linux sync databases: kubectx from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Utility to manage and switch between kubectl contexts and Kubernetes namespaces | https://github.com/ahmetb/kubectx
- zypper - kubectx - 0.11.0-1.2: normalized package name match | openSUSE Tumbleweed package metadata: kubectx from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Faster way to switch between clusters and namespaces in kubectl | https://github.com/ahmetb/kubectx
- zypper - kubectx-bash-completion - 0.11.0-1.2: normalized package name match | openSUSE Tumbleweed package metadata: kubectx-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Bash Completion for kubectx | https://github.com/ahmetb/kubectx
- zypper - kubectx-fish-completion - 0.11.0-1.2: normalized package name match | openSUSE Tumbleweed package metadata: kubectx-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Fish Completion for kubectx | https://github.com/ahmetb/kubectx
- zypper - kubectx-zsh-completion - 0.11.0-1.2: normalized package name match | openSUSE Tumbleweed package metadata: kubectx-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Zsh Completion for kubectx | https://github.com/ahmetb/kubectx
- MacPorts - kubectx: normalized package name match | MacPorts ports tree: sysutils/kubectx/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - kubectx: normalized package name match | Chocolatey community package catalog: kubectx from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','kb5001567'
- Scoop - main/kubectx: normalized package name match | Scoop official bucket manifest trees: bucket/kubectx.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - ahmetb.kubectx: normalized package name match | Windows Package Manager source index: ahmetb.kubectx from https://cdn.winget.microsoft.com/cache/source.msix


## 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.
- [kubecm](https://www.automicvault.com/pkg/brew/kubecm/) - Shares av.db curated category or tags: cli, developer-tools, kubeconfig, kubectl, kubernetes.
- [krew](https://www.automicvault.com/pkg/brew/krew/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubecolor](https://www.automicvault.com/pkg/brew/kubecolor/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubectl-ai](https://www.automicvault.com/pkg/brew/kubectl-ai/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubectl-tree](https://www.automicvault.com/pkg/brew/kubectl-tree/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubelogin](https://www.automicvault.com/pkg/brew/kubelogin/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubergrunt](https://www.automicvault.com/pkg/brew/kubergrunt/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.
- [kubernetes-cli](https://www.automicvault.com/pkg/brew/kubernetes-cli/) - Shares av.db curated category or tags: cli, developer-tools, kubectl, kubernetes.

## 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
- package-page enrichment
- curated configuration and credential file locations
- 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
