Managed Kubernetes
Latest
Frequently Asked Questions
Solutions
How Tos
Internal Only
Templates
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Configure BASH Autocomplete for Kubectl CLI on MacOS X
Copy Markdown
Open in ChatGPT
Open in Claude
Problem
When working with the Kubectl CLI often, it is much more efficient to be able to autocomplete long commands and resource names.
Environment
- Platform9 Managed Kubernetes - All Versions
- MacOS X - v10.13.x
Procedure
- Install the Homebrew binary.
command
xxxxxxxxxx$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"- Install the bash-completion package.
command
xxxxxxxxxx$ brew install bash-completion- If you do not have a dedicated terminal and need to enable autocompletion on the fly, run the following command.
command
xxxxxxxxxx$ source <(kubectl completion zsh)Otherwise, append the following command to your .zshrc file to enable autocomplete persistently.
command
xxxxxxxxxx$ echo "source <(kubectl completion zsh)" >> ~/.zshrcIf above command fails with error "Command not found: compdef" then run below command to load compinit:
Javascript
xxxxxxxxxx$ autoload -Uz compinit$ compinitAdditional Information
See Kubernetes Reference: Kubectl Cheat Sheet for more handy commands and configurations.
VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
Last updated on
Was this page helpful?
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message