Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active January 24, 2025 23:34
Show Gist options
  • Save magnetikonline/cf40e813b7bb87e94df955d0c80cd310 to your computer and use it in GitHub Desktop.
Save magnetikonline/cf40e813b7bb87e94df955d0c80cd310 to your computer and use it in GitHub Desktop.
Install AWS CLI v2 from source.

Install AWS CLI v2 from source

Bash script to install the latest released version of the AWS CLI v2 from the distrubuted source.

Using this method to exectue the CLI under a MacBook M1 laptop as a native ARM binary - rather than falling back to Rosetta. Currently the offically packaged macOS .pkg doesn't support both Intel/M1 architectures.

Script designed to be re-run - will blow away an existing install and re-install the latest available version.

Note

This install script assumes you have installed a suitable version of Python 3 - has been tested against:

  • Python 3.12.7 under macOS Sonoma v14.7.2.
  • Python 3.10.11 under macOS Sonoma v14.6.1.

Usage

$ ./install.sh

$ which aws
/usr/local/bin/aws

$ which aws_completer
/usr/local/bin/aws_completer

$ aws --version
aws-cli/2.23.0 Python/3.12.7 Darwin/23.6.0 source-sandbox/arm64

Related

#!/bin/bash -e
# see: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-source-install.html
WORK_DIR=$(mktemp -d)
# install virtualenv
unset PIP_USER
PIP_USER="1" pip3 install --user virtualenv
# download source package and un-tar
curl --silent https://awscli.amazonaws.com/awscli.tar.gz | \
tar --directory "$WORK_DIR" --extract --gzip
pushd "$WORK_DIR"
cd "$(ls -1)"
# drop existing installed aws-cli, configure and install
sudo rm -fr /usr/local/lib/aws-cli
./configure --with-download-deps
make
sudo make install
popd
# cleanup
sudo rm -fr "$WORK_DIR"
aws --version
@njohnson-personal
Copy link

Tried with Python 3.13 and the make command failed. Using Python 3.12 was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment