I am following the AWS CLI Setup guide. I have managed to successfully install the tool on my Mac OS X terminal with the following output:

Running cmd: /usr/bin/python virtualenv.py --python /usr/bin/python /Users/fr/.local/lib/aws
Running cmd: /Users/fr/.local/lib/aws/bin/pip install --no-index --find-links file:///Users/fr/Downloads/awscli-bundle/packages awscli-1.5.3.tar.gz
You can now run: /Users/fr/.local/lib/aws/bin/aws --version

My issue is that I have to type the full path /Users/fr/.local/lib/aws/bin/aws to execute any aws command. As per the guide's final step, I should be able to execute aws command directly without typing the absolute path for it to execute.

When I try using just aws, I get the following output:

aws --version                                                                                         ⏎
command not found: aws

I followed the instructions to make sure that ~/bin is in my PATH environment and I could see there was no output, hence, I executed the export PATH=~/bin:$PATH command to add ~/bin to $PATH. But this has made no difference. The aws command does not work directly.

Could someone please advise what could be going wrong?


Solution 1:

Here are the three steps to install AWS cli on mac OSX (curl or wget) The third step will set you path correctly

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

The other easiest way is to do using homebrew

brew install awscli

If you want the development version you can do

brew install awscli --HEAD

Solution 2:

This worked for me (note: change 2.7 to your specific Python version):

export PATH=~/Library/Python/2.7/bin/:$PATH

You'll likely want to add this to the end of your .bash_profile using:

sudo nano ~/.bash_profile

Solution 3:

when you run the command: pip3 install awscli --upgrade --user

watch closely where the aws cli tool gets installed, you can see the path on terminal log, in my case I got something like this:

awscli in ./Library/Python/3.6/lib/python/site-packages

Now you should add to your .bash_profile the same path but on the bin folder(removing from the lib path and instead put your bin path) like this:

export PATH=/Users/xuser/Library/Python/3.6/bin/:$PATH

Solution 4:

I have used Homebrew to install AWS CLI and I am quite happy with the result. Simply type:

$ brew install awscli

after you have installed brew.

Note, on the AWS CLI installation page there is the following disclaimer:

The awscli package may be available in repositories for other package managers such as APT, yum and Homebrew, but it is not guaranteed to be the latest version.

That said, I have not found this to be a problem, the awscli.rb has been updated quite frequently to match the latest releases.


Update: there is a GitHub issue that suggests that Homebrew should be added as an alternative in the AWS CLI installation instructions. This issue was later closed in favor of this UserVoice feature request.

Solution 5:

This happened to me as well and did not want to install brew anymore, because everything was running fine already. I also followed the 'tutorial' on AWS site and had problem in the export path step.

Basically, it added a different python folder as the one, where awscli was downloaded. So instead of export PATH=~/.local/bin:$PATH what they suggested I used a full path from disk: export PATH=/Users/abc/Library/Python/3.6/bin/:$PATH