Skip to content

Commit 2ca1c07

Browse files
authored
Update the Mac autocomplete to use bash_profile
On OS X, Terminal by default runs a login shell every time, thus I believe it is simpler for new users to not have to change to change the default. behaviour or source the bashrc file every time. https://apple.stackexchange.com/questions/51036/what-is-the-difference-between-bash-profile-and-bashrc
1 parent 735259f commit 2ca1c07

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

content/en/docs/tasks/tools/install-kubectl.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ You can test if you have bash-completion v2 already installed with `type _init_c
419419
brew install bash-completion@2
420420
```
421421
422-
As stated in the output of this command, add the following to your `~/.bashrc` file:
422+
As stated in the output of this command, add the following to your `~/.bash_profile` file:
423423
424424
```shell
425425
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
@@ -432,10 +432,10 @@ Reload your shell and verify that bash-completion v2 is correctly installed with
432432
433433
You now have to ensure that the kubectl completion script gets sourced in all your shell sessions. There are multiple ways to achieve this:
434434
435-
- Source the completion script in your `~/.bashrc` file:
435+
- Source the completion script in your `~/.bash_profile` file:
436436
437437
```shell
438-
echo 'source <(kubectl completion bash)' >>~/.bashrc
438+
echo 'source <(kubectl completion bash)' >>~/.bash_profile
439439
440440
```
441441
@@ -448,8 +448,8 @@ You now have to ensure that the kubectl completion script gets sourced in all yo
448448
- If you have an alias for kubectl, you can extend shell completion to work with that alias:
449449
450450
```shell
451-
echo 'alias k=kubectl' >>~/.bashrc
452-
echo 'complete -F __start_kubectl k' >>~/.bashrc
451+
echo 'alias k=kubectl' >>~/.bash_profile
452+
echo 'complete -F __start_kubectl k' >>~/.bash_profile
453453
```
454454
455455
- If you installed kubectl with Homebrew (as explained [above](#install-with-homebrew-on-macos)), then the kubectl completion script should already be in `/usr/local/etc/bash_completion.d/kubectl`. In that case, you don't need to do anything.

0 commit comments

Comments
 (0)