Merge pull request #3737 from cblecker/update-mac-bash

Update directions for macOS bash completion
This commit is contained in:
Andrew Chen
2017-06-06 09:02:44 -07:00
committed by GitHub
+11 -10
View File
@@ -142,28 +142,29 @@ echo "source <(kubectl completion bash)" >> ~/.bashrc
```
### On macOS, using bash
On macOS, autocompletion works if you install using `brew install kubectl`,
and not if you downloaded kubectl directly.
Install the bash-completion support:
On macOS, you will need to install bash-completion support via [Homebrew](https://brew.sh/) first:
```shell
## If running Bash 3.2 included with macOS
brew install bash-completion
## or, if running Bash 4.1+
bash install bash-completion@2
```
To add kubectl autocompletion to your current shell, run:
Follow the "caveats" section of brew's output to add the appropriate bash completion path to your local .bashrc.
```shell
source $(brew --prefix)/etc/bash_completion
source <(kubectl completion bash)
```
If you've installed kubectl using the [Homebrew instructions](#install-with-homebrew-on-macos) then kubectl completion should start working immediately.
If you have installed kubectl manually, then run: `source <(kubectl completion bash)`
To add kubectl autocompletion to your profile (so it is automatically loaded in future shells):
```shell
echo "source $(brew --prefix)/etc/bash_completion" >> ~/.bash_profile
echo "source <(kubectl completion bash)" >> ~/.bash_profile
```
The Homebrew project is independent from kubernetes, so the bash-completion packages are not guaranteed to work.
{% endcapture %}
{% capture whatsnext %}
[Learn how to launch and expose your application.](/docs/user-guide/quick-start)