Aws-cli: Install aws-cli using Homebrew

Created on 29 Mar 2014  ·  42Comments  ·  Source: aws/aws-cli

My awscli formula has been merged and is officially available with Homebrew.

It would be useful to add Homebrew as an installation option in the README.

As a suggestion something like this,

Homebrew on Mac OS X

aws-cli can also be installed using the Homebrew package manager on Mac OS X:

brew install awscli

If you want the development version of aws-cli:

brew install awscli --HEAD

After installation brew will provide instructions for installing completion and where to find the examples on how to use aws-cli.

feature-request installation

Most helpful comment

Agreed. Homebrew appeals to a much broader audience than pip.

All 42 comments

Agreed. Homebrew appeals to a much broader audience than pip.

Release history is pretty good but still a bit spotty. https://github.com/Homebrew/homebrew/commits/master/Library/Formula/awscli.rb

This should be made official

Does anyone know how to use pip to install awscli after installing Python with Homebrew? It seems like the path files go wrong somewhere as it's looking for the aws-cli executable in /usr/local/bin/ but if you do

sudo pip install awscli 

that places it in /usr/bin/ instead. I got the following error:

Traceback (most recent call last):
   File "/usr/local/bin/aws", line 15, in <module>
   import awscli.clidriver
ImportError: No module named awscli.clidriver

Just looking for some background info if someone wouldn't mind answering.

What, if anything, can the AWS CLI team do to ensure that we're keeping the homebrew releases in sync with the latest CLI releases? We typically release 1 to 2 times a week. If we officially support this, we'll need to ensure we can have the same release cadence as our other normal release channels (pip, bundled installer, MSIs).

And if I recall correctly, there's going to be some delay no matter what because the PR for the updated CLI versions still needs to be merged into homebrew's master branch each release correct?

Again just trying to get a feel for what's involved.

@iz2140 I'd double check which pip you're using. If you install Python with Homebrew, you should have pip installed to /usr/local/bin/pip. That should install the AWS CLI into /usr/local/bin/.

@jamesls I ended up just uninstalling AWSCLI using pip and re-installing with Homebrew and everything turned out okay. Thanks though!

I’d also love to see an official Homebrew install option.

If someone wouldn't mind chiming in for some of the questions I asked here, we can explore this option further. Marking as a feature request for now.

Homebrew's contribution process is explained here: https://github.com/Homebrew/homebrew/blob/master/CONTRIBUTING.md

I'd expect a dialog with the Homebrew team after a pull request would be the best place to deal with your timing questions.

Given I've been running the same version of aws-cli from Homebrew, I'm not sure I need anything more than a weekly update.

Bump

@jamesls thank you for responding. I think I found some answers to your questions.

For virtually instantaneous synchrony, just use a URL, e.g.:

brew install https://s3.amazonaws.com/homebrew/formulae/aws-cli.rb

Run man brew to show the brew(1) manpage, and see SPECIFYING FORMULAE.

Otherwise, yes, there will likely be some delay: According to How To Open a Homebrew Pull Request (and get it merged), "[Homebrew's maintainers] typically respond to all PRs within a couple days."

Note: If you choose to add a new formula to Homebrew Core, name the formula aws-cli, not awscli, because it's called aws-cli on Github and Homebrew Formula Cookbook: A Quick Word on Naming says, "Name the formula like the project markets the product. So it’s pig-config, not pkgconfig; sdl_mixer, not ssl-mixer or sdlmixer." The same goes for the pip package name. See #2090.

Below are some more links I found that document how to create & update a Homebrew formula.

Does that answer your questions?

Best wishes & good luck in officially supporting the installation of AWS CLI via Homebrew!

If you have anymore questions, concerns, or requests, please let us know.

FYI, there are some dead links in there @mattdipasquale

Thank you, @dijonkitchen. I think I revived them all.

If the AWS team is going to go so far as to maintain their own brew recipe, they might as well go a step further and create a tap.

This explains the meaning of brew tap. https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md

Essentially, what that means is that this github aws account would create a repository called [something like] "homebrew-aws" and put the recipe in there.

@jamesls should be familiar with this concept since he has done this for jmespath at https://github.com/jmespath/homebrew-jmespath
So, to answer his question above I'd suggest that either add the formula to his jmespath/homebrew-jmespath or create a aws/homebrew-aws repo. Then update reference to brew at http://docs.aws.amazon.com/cli/latest/userguide/installing.html#choosing-an-installation-method to describe doing either...

brew tap jmespath/jmespath
brew install jmespath/jmespath/awscli

...or...

brew tap aws/aws
brew install aws/aws/awscli

...as an official installation method. If you do not, then for better or worse https://github.com/Homebrew/homebrew-core/blob/master/Formula/awscli.rb is what the majority of Mac users are going to be installing because this looks pretty damn official...

$ brew info awscli
awscli: stable 1.11.5 (bottled), HEAD
Official Amazon AWS command-line interface
https://aws.amazon.com/cli/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/awscli.rb

@mattdipasquale your https://s3.amazonaws.com/homebrew/formulae/aws-cli.rb url above seems to have problems.

$ curl -s https://s3.amazonaws.com/homebrew/formulae/aws-cli.rb | xmllint --format -
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AllAccessDisabled</Code>
  <Message>All access to this object has been disabled</Message>
  <RequestId>636AE6C270CD649F</RequestId>
  <HostId>y8HMrOTA5l7SMOQM5uh0xZ5tdCumNk8td0RPLJh53kVHypP+K1s7OD8pJLSlcs70rsfzTDGEXDg=</HostId>
</Error>

@RichardBronosky I think @mattdipasquale just meant that as an example.

Another +1 for just adding the suggested info to the README for now. It seems like they've been tracking closely enough for the most part. I'm using their formula to keep aws-cli up to date, and it hasn't seemed to be a problem.

Quick analysis of time deltas between releases from the AWS team and the Homebrew maintainers here, along with the gist of the hacky bits to get to the analysis.

Is there currently any reason not to use Homebrew over pip to install and maintain AWS command line tools?

Is the procedure for migrating an existing pip-based installation to Homebrew a simple matter of

pip uninstall awsebcli
pip uninstall awscli
brew install awscli
brew install awsebcli

or is there more to it?

@orome It should work, it seems that the homebrew package is pretty up to date. However, we don't make any guarantees that it will work, so if the formula breaks then you'll need to seek help from whoever is maintaining it.

@JordonPhillips: And just to confirm:

  1. there's nothing different about the two approaches (at least not intentionally; e.g., paths, locations of settings, etc); and
  2. there's nothing destructive about the pip uninstall ... steps listed above (I won't loose settings or certs).

Correct?

Might not be an issue, but if both python (2) and python3 are installed via brew, installing awscli also through brew defaults to the python 2.7 build. Am I missing something in how my PATH is set up? Is there anyway to have brew install awscli use the python3 build?

brew install awscli installs 1.11.80 (develop I guess) versus 1.10.38 which I take as the stable version. see: https://aws.amazon.com/releasenotes/CLI?browse=1

brew install awscli --HEAD results in the same version.

From the post at top of this thread I expected the first to install 1.10.38 and the --HEAD install to result in 1.11.80. Any clarification appreciated.

note: moving this to homebrew

@jdhom Can you link to where this issue continues on Homebrew?

I have the same question as @sksea:

Might not be an issue, but if both python (2) and python3 are installed via brew, installing awscli also through brew defaults to the python 2.7 build. Am I missing something in how my PATH is set up? Is there anyway to have brew install awscli use the python3 build?

I want to know this as well -

Might not be an issue, but if both python (2) and python3 are installed via brew, installing awscli also through brew defaults to the python 2.7 build. Am I missing something in how my PATH is set up? Is there anyway to have brew install awscli use the python3 build?

Thinking this through again I feel the right approach now is to leverage a docker microcontainer with awscli installed and leverage this package to remote control that container, which would contain a pre-installed version of the official cli.

@manik-chopra @sksea I haven't found a way to have awscli use python3 via brew, but an alternative is to use the bundled installer. You can have your awscli use the python3 build. There's instructions for using a specific python version at step 3. This isn't a homebrew solution, but if you absolutely need to get it done, this is one way.

Bundled installer requires: Python 2 version 2.6.5+ or Python 3 version 3.3+ and isn't how the Homebrew package works AFAIK. As a result, it's not clear if using bundled installer is a suggestion to resolve this issue or just a workaround.

Bumping this again. If we can just add the info to the README, I think this could be closed.

The maintainers of the Homebrew formula have updated it within 3 days of a new awscli release since this request was made in 2014, on average; in the past year, that average has been less than 14 hours*. That seems to answer the concerns that @jamesls raised regarding staying in sync. Building this with Python 3 vs. Python 2 is a question for Homebrew and not the awscli team.

I'm +2 on this one. It seems a bit silly it's still floating around more than three years after the ask.

*Analysis available here; crappy code that generates it here.

This is key and should be in the AWS Docs as a supported option. Compared to other tools, the installation of the AWS CLI is multi-step and complicated for many users (not that bad, but not as simple as a brew install).

Good Morning!

We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.

This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.

As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.

We’ve imported existing feature requests from GitHub - Search for this issue there!

And don't worry, this issue will still exist on GitHub for posterity's sake. As it’s a text-only import of the original post into UserVoice, we’ll still be keeping in mind the comments and discussion that already exist here on the GitHub issue.

GitHub will remain the channel for reporting bugs.

Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface

-The AWS SDKs & Tools Team

This entry can specifically be found on UserVoice at: https://aws.uservoice.com/forums/598381-aws-command-line-interface/suggestions/33168301-install-aws-cli-using-homebrew

🤣

Hi, @ASayre. I recognize this is just a small part of your mass migration, and that you're likely getting a lot of noise around all of that. This issue could be resolved with an update to the README, and just be done. It's been waiting for 3 years for someone to care enough to make that update.

Good luck in your future endeavors.

PR #3193 created for this. Upvote/pester there! 😆

Based on community feedback, we have decided to return feature requests to GitHub issues.

I just wasted an hour running ruby commands, installing python / pip, trying to fiddle with my PATH variables, and it still didn't work. Someone should completely delete all of the content on this page and just replace it with, "run brew install awscli".

This worked for me on High Sierra:

sudo pip install awscli --ignore-installed six

The uservoice site, referenced above, seems dead: https://aws.uservoice.com/forums/598381-aws-command-line-interface

This site is not currently active

@alecmroo see @jamesls's comment above:

Based on community feedback, we have decided to return feature requests to GitHub issues.

Does not install latest AWS CLI: brew install awscli --HEAD

brew info awscli: awscli: stable 1.15.40 (bottled), HEAD

Latest AWS CLI version should be: 1.15.47

I'm unable to run this command: aws ec2 modify-vpc-tenancy

Anyone know how I can use brew to install AWS CLI version 1.15.47..?

Should just be @ some version #: https://docs.brew.sh/Versions

Was this page helpful?
0 / 5 - 0 ratings