The doc for installing the AWS CLI, if you don’t have pip and choose to use python3, has one little trick to it.
Installing AWS CLI with python3 on macOS
- Download the latest version of python
- Run the package installer and delete it when finished
- Install pip by running these commands. The
curl -O https://bootstrap.pypa.io/get-pip.py python3 get-pip.py --user
- Install the aws cli. Again,
pip3 install awscli --upgrade --user
- Step 4 mentioned in the aws doc says to verify the cli is installed by running
aws --version. Run the command, if it fails, continue reading. If it doesn’t, you’re good to go
- We need to get the cli added to your path. This is where the trick comes in. The doc suggests the aws bin is at
~/Library/Python/3.6/bin, which it is. However, the doc goes on to say
pip installs executables to the same folder that contains the Python executable. Add this folder to your PATH variable.
which is not true. It’s installed at
~/Library/Python/3.6/bin. The pip docs say
The default location for each OS is explained in the python documentation for the site.USER_BASE variable.
site.USER_BASE turns out to be
~/Library/Python/X.Y. That’s why
--useris important. You’re installing into the user space.
- So, you’ll want to add
~/Library/Python/3.6/binto your path to run the aws bin
Some of you may just see the location aws suggests and run with it. But it annoyed me that it wasn’t clear why they called out that location. I found satisfaction in getting to the bottom of this and maybe it will help someone else.