AWS CLI
Mac OS
Pip Installation
Command Not Found
Troubleshooting

I cannot install aws cli on mac os with pip - awscli command not found

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

On macOS, aws: command not found usually does not mean the package failed to install. More often, pip placed the executable in a directory that your shell does not search, or it installed into a different Python environment than the one you expect. The fix is to verify where pip wrote the aws command, then either adjust PATH or reinstall into the right environment.

Check Which Python and pip You Are Using

The first step is to stop guessing. On macOS it is common to have multiple Python installations from Xcode tools, Homebrew, pyenv, or virtual environments. pip may point to one interpreter while your shell is using another.

Run these commands and compare the paths:

bash
1which python3
2python3 --version
3which pip3
4python3 -m pip --version

The most reliable installer invocation is python3 -m pip because it ties pip to a specific interpreter. If you use plain pip, you can easily install into a different environment than the one your terminal session expects.

If python3 -m pip --version prints a valid location but aws still cannot be found, the package is likely installed and the real problem is shell lookup.

Find Where the aws Executable Was Installed

When pip installs a command-line tool, it places the executable in a scripts directory. On macOS that is often a user-level path under your home directory.

These commands show the relevant locations:

bash
python3 -m site --user-base
python3 -m pip show awscli

If the package is installed, pip show prints its metadata and install location. The executable is commonly placed in:

bash
$(python3 -m site --user-base)/bin

For a typical user install, that expands to something like ~/Library/Python/3.x/bin. If that directory is not on PATH, typing aws will fail even though the package exists.

Install Cleanly Into the User Environment

If the package is not installed, install it explicitly with the same interpreter you plan to use:

bash
python3 -m pip install --user awscli

Then confirm that the command exists:

bash
ls "$(python3 -m site --user-base)/bin/aws"

If the file exists, add the user scripts directory to PATH. On modern macOS systems using zsh, place the export in ~/.zshrc.

bash
echo 'export PATH="$HOME/Library/Python/3.11/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
aws --version

Replace 3.11 with the version from your own environment. If you want a version-independent approach, you can use the computed user base:

bash
export PATH="$(python3 -m site --user-base)/bin:$PATH"
aws --version

That command is useful for testing before you make the change permanent in your shell config.

Understand Virtual Environments and Homebrew Installs

If you are inside a virtual environment, pip install awscli installs into that environment. Once you leave it, aws disappears because the virtual environment bin directory is no longer active.

bash
1python3 -m venv .venv
2source .venv/bin/activate
3python3 -m pip install awscli
4which aws
5aws --version
6deactivate

That behavior is correct, but it surprises people who intended a global tool install. For an everyday shell command, install either with --user, via Homebrew, or with the official AWS CLI installer depending on your team standard. The important part is consistency: use one installation method and know where its binaries live.

Homebrew users should also check for duplicate installs:

bash
which -a aws

If several paths appear, your shell may be picking up an older binary first.

A Reliable Troubleshooting Sequence

When you want a fast diagnosis, use this order:

  1. Run python3 -m pip show awscli.
  2. If it is missing, install with python3 -m pip install --user awscli.
  3. If it is present, find the scripts directory with python3 -m site --user-base.
  4. Add that directory's bin subdirectory to PATH.
  5. Verify with which aws and aws --version.

This sequence avoids the most common macOS confusion, which is repeatedly reinstalling the package when the real issue is only shell lookup.

Common Pitfalls

  • Using pip install awscli with one Python interpreter and expecting another interpreter's environment to expose the command.
  • Updating PATH in ~/.bash_profile while your shell is actually zsh and reads ~/.zshrc.
  • Installing inside a virtual environment and then expecting aws to work after deactivation.
  • Mixing Homebrew, user-level pip, and system Python installs without checking which -a aws.
  • Reinstalling repeatedly before running python3 -m pip show awscli to confirm whether the package is already present.

Summary

  • 'aws: command not found on macOS is usually a PATH or environment mismatch, not a mysterious install failure.'
  • Use python3 -m pip so the installer is tied to a specific interpreter.
  • Check the user scripts directory with python3 -m site --user-base.
  • Add the matching bin directory to PATH in the shell config your terminal actually uses.
  • Verify the final state with which aws and aws --version.

Course illustration
Course illustration