How to Fix AWS CLI Tools When Homebrew Breaks Python

I installed stunnel on my mac via homebrew. I wasn't expecting the Spanish Inquisition. Homebrew did a giant update including some craziness with Python. I'm not sure what happened, but it broke all my virtual environments. I thought those were supposed to be independent, but that's another story. They were easy enough to fix. I just blew them away and recreated them.

The other thing that went sideways was the AWS CLI. When I tried to run a command, I'd get this:

Per this page, I uninstalled the remains of homebrew's pytyon 2 via:

After that, I tried another aws command:

In fact, running just `aws` by itself produces the same error

Figured it was time to start over. My next step was to reinstall aws-cli. The Amazon page for the aws-cli tool says to do updates the same way you did the initial install. I don't remember how I did that so I removed the existing install first. The note says to find your `aws` command with `which`:

The notes say to uninstall `aws` and `aws_completer`, but there are other files there as well: `aws_bash_completer`, `aws_zsh_completer.sh` and `aws.cmd`. I deleted them with:

I ran `which` again and there was another `aws` command floating around:

I tried using it, but got a similar error:

The same set of files was showed up in the new directory:

I deleted them as well and finally cleared the system of the `aws` command.

The Amazon page also talks about deleting:

But I didn't have that. So, I just moved on.

I installed aws-cli via the the mac gui and that got things working again.

Just installing over top might have worked, but the directions said to install the same way you did the first time. That's a poor UX, but it is what it is. Since I don't remember how I installed originally, I just nuked the site from orbit and started over. It's was the only way to be sure.