Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active September 10, 2024 23:53
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.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.15.45 Python/3.10.11 Darwin/23.4.0 source-sandbox/arm64 prompt/off

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
@user152342
Copy link

user152342 commented Sep 10, 2024

that python 3.10.11 note is crucial if only have 3.9 installed from default macos/work image (3.9 doesn't work!!!)

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