Install Kubernetes-cli with Homebrew on macOS

Run the installation command:

brew install kubernetes-cli

Test to ensure the version you installed is sufficiently up-to-date:

kubectl version

If you have installed kubectl manually, you need to add kubectl autocompletion to the bash-completion:

brew install bash-completion

kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl