Update directions for macOS bash completion

This commit is contained in:
Christoph Blecker
2017-05-16 16:44:39 -07:00
parent 9f2ecee260
commit 1bb02c055e
+11 -10
View File
@@ -142,28 +142,29 @@ echo "source <(kubectl completion bash)" >> ~/.bashrc
``` ```
### On macOS, using bash ### On macOS, using bash
On macOS, autocompletion works if you install using `brew install kubectl`, On macOS, you will need to install bash-completion support via [Homebrew](https://brew.sh/) first:
and not if you downloaded kubectl directly.
Install the bash-completion support:
```shell ```shell
## If running Bash 3.2 included with macOS
brew install bash-completion 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 If you've installed kubectl using the [Homebrew instructions](#install-with-homebrew-on-macos) then kubectl completion should start working immediately.
source $(brew --prefix)/etc/bash_completion
source <(kubectl completion bash) 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): To add kubectl autocompletion to your profile (so it is automatically loaded in future shells):
```shell ```shell
echo "source $(brew --prefix)/etc/bash_completion" >> ~/.bash_profile
echo "source <(kubectl completion bash)" >> ~/.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 %} {% endcapture %}
{% capture whatsnext %} {% capture whatsnext %}
[Learn how to launch and expose your application.](/docs/user-guide/quick-start) [Learn how to launch and expose your application.](/docs/user-guide/quick-start)