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:
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:
If the package is installed, pip show prints its metadata and install location. The executable is commonly placed in:
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:
Then confirm that the command exists:
If the file exists, add the user scripts directory to PATH. On modern macOS systems using zsh, place the export in ~/.zshrc.
Replace 3.11 with the version from your own environment. If you want a version-independent approach, you can use the computed user base:
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.
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:
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:
- Run
python3 -m pip show awscli. - If it is missing, install with
python3 -m pip install --user awscli. - If it is present, find the scripts directory with
python3 -m site --user-base. - Add that directory's
binsubdirectory toPATH. - Verify with
which awsandaws --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 awscliwith one Python interpreter and expecting another interpreter's environment to expose the command. - Updating
PATHin~/.bash_profilewhile your shell is actuallyzshand reads~/.zshrc. - Installing inside a virtual environment and then expecting
awsto work after deactivation. - Mixing Homebrew, user-level
pip, and system Python installs without checkingwhich -a aws. - Reinstalling repeatedly before running
python3 -m pip show awsclito confirm whether the package is already present.
Summary
- '
aws: command not foundon macOS is usually aPATHor environment mismatch, not a mysterious install failure.' - Use
python3 -m pipso the installer is tied to a specific interpreter. - Check the user scripts directory with
python3 -m site --user-base. - Add the matching
bindirectory toPATHin the shell config your terminal actually uses. - Verify the final state with
which awsandaws --version.

