“AWS CLI: command not found on” macOS

Today a very short blog post about the AWS CLI.

I had following terminal output “zsh: command not found: aws” after the installation of the AWS CLI on macOS, because AWS CLI uses python and you need to ensure you did configure python right. That make it a little-bit more tricky for me to install that CLI on my machine, compared for example to the IBM Cloud CLI.

In my case I have installed python3 on my macOS, because I like to use MKDocs writing documentations and I don’t using the normal python command, so I only using the python3 command. I followed all written steps in AWS CLI documentation and they worked, but at the end I wasn’t able to invoke following command:

$ aws --version
zsh: command not found: aws

Because of the python usage in the AWS CLI, I inspected my python installation a bit, by assuming maybe the AWS CLI uses the command python and not python3 internally. So, I verified that the python command can be invoked on my machine and as you can see in the following terminal output it didn’t work as I expected 😉

$ which python
python not found

But the python3 command invoked worked on my machine.

$ which python3

So, I created an alias for the python command and added in addition the Python-3.9 bin path to the PATH variable. Then I updated to two profiles for the shells I using on my machine.

nano ~/.bash_profile
nano ~/.zshrc

The following code contains my changes in the two profile files:

# Python for AWS settings
alias python=python3

Now the command works 🙂

aws --version
aws-cli/1.25.2 Python/3.9.12 Darwin/21.5.0 botocore/1.27.2

Thats all …

I hope this was useful to you and let’s see what’s next?



#awscli, #macos, #python

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: