To install kubectl on a Mac, you can use one of the following methods:
Method 1: Using Homebrew
-
Open Terminal.
-
Install kubectl using Homebrew with the following command:
brew install kubectl -
Verify the installation:
kubectl version --client
Method 2: Using curl
-
Open Terminal.
-
Download the latest release of
kubectl:curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl" -
Make the binary executable:
chmod +x ./kubectl -
Move the binary to your PATH:
sudo mv ./kubectl /usr/local/bin/kubectl -
Verify the installation:
kubectl version --client
Choose the method that you prefer, and you'll have kubectl installed on your Mac.
