2

Similar to this question:

How do I get the aws cli completion to work with zsh on ubuntu?

This command from the aws-cli documentation did not properly setup auto completion.

source /usr/local/bin/aws_zsh_completer.sh

1
  • Welcome to Super User. Common mistake some members make is formatting. Just posting links is not acceptable because they break. Please type out the actual problem and reference with the links. Take a minute to edit your question to make it fit the format of this site. Reading How to Ask may be helpful.
    – CharlieRB
    Commented Apr 29, 2016 at 15:20

4 Answers 4

3

To run command completion:

  1. Run bashcompinit by adding the following autoload line at the end of your ~/.zshrc profile script.

    autoload bashcompinit && bashcompinit

  2. Enable command completion, use the built-in command complete.

    complete -C '/usr/local/bin/aws_completer' aws

  3. Add the commands to ~/.zshrc to run it each time you open a new shell.

  4. Test auto completiion

aws sTAB - should display something similar to this: Test Screenshot

For other shells, review this document.

0

This worked for me:

source /usr/local/share/zsh/site-functions/_aws
$echo 'source /usr/local/share/zsh/site-functions/_aws' >> ~/.zshrc

Source

1
  • I get this error on my mac using zsh -> 9:41:24 Fri 25 code 1013:13-127$ source /usr/local/share/zsh/site-functions/_aws source: no such file or directory: /usr/local/share/zsh/site-functions/_aws 9:44:03 Fri 25 code 1014:14-127$
    – Nabheet
    Commented Sep 25, 2020 at 15:45
0

For MacOS

  • Find the path of the aws_completer using the command which aws_completer and copy the output path

  • Then find the running shell using the command echo $SHELL

  • Open the shell file (mine is zsh - ~/.zshrc)

  • Add the below lines in your shell file

    complete -C '<add_the_path_copied_from_first_step>' aws

  • Then use the source command to update the file changes. For example: source ~/.zshrc

-1

You need to have the aws_completer in your path for this to work correctly. Another option would be to modify the aws_zsh_completer.sh script.

complete -C aws_completer aws

complete -C <pathtoaws_completer>/aws_completer aws
2
  • complete is a bash thing. The question is about zsh.
    – John Mee
    Commented Dec 18, 2019 at 1:19
  • 1
    @JohnMee Wrong, complete is relevant to zsh as well, based on AWS CLI autocompletion docs, plus docs for other autocompletion tools
    – Mike B
    Commented Aug 9, 2022 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .