How to install kubectl on Mac, Linux and Windows
Step-by-step guide to installing kubectl on macOS, Linux and Windows. Covers Homebrew, apt, direct download, and how to set up shell completion.
4 lessons · 9 min · Beginner
Written by
Marketing Team at Civo
Written by
Marketing Team at Civo
kubectl is the command-line tool you use to interact with any Kubernetes cluster. Every command you run against a cluster, creating pods, checking deployments, reading logs, goes through kubectl. Install it before setting up any cluster.
Install on macOS
Homebrew (recommended)
brew install kubectl
Verify the installation:
kubectl version --client
Expected output:
Client Version: v1.29.0Kustomize Version: v5.0.4
Direct download (Apple Silicon)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
Direct download (Intel)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
Make the binary executable and move it to your PATH:
chmod +x ./kubectlsudo mv ./kubectl /usr/local/bin/kubectl
Verify:
kubectl version --client
Install on Linux
apt (Debian and Ubuntu)
sudo apt-get updatesudo apt-get install -y apt-transport-https ca-certificates curlcurl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgecho 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.listsudo apt-get updatesudo apt-get install -y kubectl
Verify:
kubectl version --client
Direct download (Linux AMD64)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"chmod +x ./kubectlsudo mv ./kubectl /usr/local/bin/kubectl
Verify:
kubectl version --client
Install on Windows
Chocolatey (recommended)
choco install kubernetes-cli
Verify:
kubectl version --client
Direct download
Download the latest release:
curl.exe -LO "https://dl.k8s.io/release/v1.29.0/bin/windows/amd64/kubectl.exe"
Move kubectl.exe to a directory that is in your PATH, for example C:\Program Files\kubectl\. Then add that directory to your PATH environment variable via System Properties.
Verify:
kubectl version --client
Set up shell completion
Shell completion lets you tab-complete kubectl commands and resource names. It is one of the most useful quality-of-life improvements you can make after installing kubectl.
zsh (macOS default)
Add the following to your ~/.zshrc:
source <(kubectl completion zsh)
Then reload your shell:
source ~/.zshrc
bash (Linux)
kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
Reload your shell:
source /etc/bash_completion.d/kubectl
fish
kubectl completion fish | source
To make it permanent, add the above line to ~/.config/fish/config.fish.

Marketing Team at Civo
Civo is the Sovereign Cloud and AI platform designed to help developers and enterprises build without limits. We bridge the gap between the openness of the public cloud and the rigorous security of private environments, delivering full cloud parity across every deployment. As a team, we are dedicated to providing scalable compute, lightning-fast Kubernetes, and managed services that are ready in minutes. Through CivoStack Enterprise and our FlexCore appliance, we empower organizations to maintain total data sovereignty on their own hardware.
Our mission is to make the cloud faster, simpler, and fairer. By providing enterprise-grade NVIDIA GPUs and streamlined model management, we ensure that high-performance AI and machine learning are accessible to everyone. Built for transparency and performance, the Civo Team is here to give you total control over your infrastructure, your data, and your spend.
Share this lesson