Somethings brewing with awscli

I recently updated my MacBook Pro by exercising the following Homebrew command brew update. This caused a couple of problems that led me down the path of trying to link awscli with a newer version of python.

According to the brew update command line help documentation this will update all of my installed packages and will perform migrations to ensure they interact appropriately with each other.

Fetch the newest version of Homebrew and all formulae from GitHub using git(1) and perform any necessary migrations.

brew update –help

After about an hour of downloads and installations many packages were updated to the latest versions. At this point I was excited to move on and had assumed that the necessary migrations succeeded. However this was not the case as I was welcomed with an error that led me to realize that python2 was at end-of-life EOL. I ultimately removed that package but then realized that the awscli was dependent on python 2.7.

Marks-MacBook-Pro$ aws --version
-bash: /usr/local/bin/aws: /usr/local/opt/python@2/bin/python2.7: bad interpreter: No such file or directory

Subsequent attempts to reinstall the python@2 failed because Homebrew could not longer find its formulae. I had Python3 already, but AWS CLI was not recognizing that version of Python. Here is how you can fix this problem with two simple commands.

brew reinstall awscli

After the successful reinstall of the awscli package you will need to re-link it with the newer version of python.

brew link --overwrite awscli

Now we can verify its working.

Marks-MacBook-Pro$ aws --version
aws-cli/2.0.0 Python/3.8.1 Darwin/19.3.0 botocore/2.0.0dev4

So now you know how to link awscli with a newer version of python to solve this problem. Hopefully this will save you some time in case you run into the same scenario.

I work for Capstone IT and we specialize in solving your business problems with unique and elegant solutions. Come check us out at https://www.capstonec.com.

Mark Miller
Solutions Architect
Docker Accredited Consultant
Certified Kubernetes Application Developer