Install, Update, and Uninstall the Amazon CLI version 1 on macOS - Amazon Command Line Interface
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.

Install, Update, and Uninstall the Amazon CLI version 1 on macOS

You can install the Amazon Command Line Interface (Amazon CLI) version 1 and its dependencies on macOS by using the bundled installer or pip.

Prerequisites

Before you can install the Amazon CLI version 1 on macOS, be sure you have Python 3.6 or later installed. For installation instructions, see the Downloading Python page in Python's Beginner Guide.

Warning

Python 2.7 was deprecated by the Python Software Foundation on January 1, 2020. Starting with Amazon CLI version 1.20.0, a minimum version of Python 3.6 is required.

In order to use the Amazon CLI version 1 with an older version of Python, you need to install an earlier version of the Amazon CLI version 1. To view the Amazon CLI version 1 Python version support matrix, see Python version requirements.

Install, update and uninstall the Amazon CLI version 1 on macOS using the bundled installer

On Linux or macOS, you can use the bundled installer to install version 1 of the Amazon Command Line Interface (Amazon CLI). The bundled installer includes all dependencies and can be used offline.

The bundled installer doesn't support installing to paths that contain spaces.

Install the Amazon CLI version 1 using the bundled installer with sudo

The following steps enable you to install the Amazon CLI version 1 from the command line on any build of macOS.

The following is a summary of the installation commands that you can cut and paste to run as a single set of commands.

For the latest version of the Amazon CLI, use the following command block:

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-bundle-1.16.312.zip resulting in the following command:

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

To install the Amazon CLI version 1 using the bundled installer

  1. Download the Amazon CLI version 1 bundled installer in one of the following ways:

    • Download using the curl command.

      For the latest version of the Amazon CLI, use the following command block:

      $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

      For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-bundle-1.16.312.zip resulting in the following command:

      $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip"
    • Download using the direct link.

      For the latest version of the Amazon CLI: https://s3.amazonaws.com/aws-cli/awscli-bundle.zip

      For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-exe-linux-aarch64-2.0.30.zip resulting in the following url https://s3.amazonaws.com/aws-cli/awscli-bundle-2.0.30.zip

  2. Extract (unzip) the files from the package. If you don't have unzip, use your macOs distribution's built-in package manager to install it.

    $ unzip awscli-bundle.zip
  3. Run the install program. The installer installs the Amazon CLI at /usr/local/aws and creates the symlink aws at the /usr/local/bin folder. Using the -b option to create a symlink eliminates the need to specify the install folder in the user's $PATH variable. This should enable all users to call the Amazon CLI by entering aws from any directory.

    $ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

    By default, the install script runs under the system default version of Python. If you have installed an alternative version of Python and want to use that to install the Amazon CLI, run the install script with that version by absolute path to the Python executable, as follows.

    $ sudo /usr/local/bin/python3.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
  4. Verify that the Amazon CLI installed correctly.

    $ aws --version aws-cli/1.25.55 Python/3.8.8 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13

    If you get an error, see Troubleshooting Amazon CLI errors.

Install the Amazon CLI version 1 using the bundled installer without sudo

If you don't have sudo permissions or want to install the Amazon CLI only for the current user, you can use a modified version of the previous commands. The first two commands are the same.

For the latest version of the Amazon CLI, use the following command block:

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip ./awscli-bundle/install -b ~/bin/aws

For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-bundle-1.16.312.zip resulting in the following command:

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip ./awscli-bundle/install -b ~/bin/aws

To install the Amazon CLI version 1 for the current user

  1. Download the Amazon CLI version 1 bundled installer using one of the the following methods:

    • Download using the curl command.

      For the latest version of the Amazon CLI, use the following command block:

      $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

      For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-bundle-1.16.312.zip resulting in the following command:

      $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip"
    • Download using the direct link.

      For the latest version of the Amazon CLI: https://s3.amazonaws.com/aws-cli/awscli-bundle.zip

      For a specific version of the Amazon CLI, append a hyphen and the version number to the filename. For this example the filename for version 1.16.312 would be awscli-exe-linux-aarch64-2.0.30.zip resulting in the following url https://s3.amazonaws.com/aws-cli/awscli-bundle-2.0.30.zip

  2. Extract the files from the package. If you don't have unzip, use your Linux distribution's built-in package manager to install it.

    $ unzip awscli-bundle.zip
  3. Run the install program. The installer installs the Amazon CLI at /usr/local/aws and creates the symlink aws at the /usr/local/bin directory. The command uses the -b parameter to specify the directory where the installer places the aws symlink file. You must have write permissions to the specified directory.

    $ ./awscli-bundle/install -b ~/bin/aws

    This installs the Amazon CLI to the default location (~/.local/lib/aws) and creates a symbolic link (symlink) at ~/bin/aws. Make sure that ~/bin is in your $PATH environment variable for the symlink to work.

    $ echo $PATH | grep ~/bin // See if $PATH contains ~/bin (output will be empty if it doesn't) $ export PATH=~/bin:$PATH // Add ~/bin to $PATH if necessary
  4. Ensure the folder that the Amazon CLI version 1 is installed in is part of your $PATH variable.

    1. Find your shell's profile script in your user folder. If you're not sure which shell you have, run echo $SHELL.

      $ ls -a ~ . .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads
      • Bash.bash_profile, .profile, or .bash_login

      • Zsh.zshrc

      • Tcsh.tcshrc, .cshrc or .login

    2. Add an export command at the end of your profile script that's similar to the following example.

      export PATH=~/.local/bin:$PATH

      This command inserts the path, ~/.local/bin in this example, at the front of the existing PATH variable.

    3. Reload the profile into your current session to put those changes into effect.

      $ source ~/.bash_profile
  5. Verify that the Amazon CLI installed correctly.

    $ aws --version aws-cli/1.25.55 Python/3.8.8 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13

    If you get an error, see Troubleshooting Amazon CLI errors.

Uninstall the Amazon CLI version 1 bundled installer

  1. The bundled installer puts everything inside of the installation directory except the optional symlink, so to uninstall, you just need to delete those two items.

    $ sudo rm -rf /usr/local/aws $ sudo rm /usr/local/bin/aws
  2. (Optional) Remove the shared Amazon SDK and Amazon CLI settings information in the .aws folder.

    Warning

    These configuration and credentials settings are shared across all Amazon SDKs and the Amazon CLI. If you remove this folder, they cannot be accessed by any Amazon SDKs that are still on your system.

    The default location of the .aws folder differs between platforms, by default the folder is located in ~/.aws/. If your user account has write permission to this directory, you don't need to use sudo.

    $ sudo rm ~/.aws/

Install, update and uninstall the Amazon CLI version 1 using pip

You can use pip directly to install the Amazon CLI.

Install pip

If you don't already have pip installed, you can install it by using the script that the Python Packaging Authority provides. Run pip --version to see if your version of Linux already includes Python and pip. We recommend that if you have Python version 3 or later installed, you use the pip3 command.

  1. Use the curl command to download the installation script. The following command uses the -O (uppercase "O") parameter to specify that the downloaded file is to be stored in the current folder using the same name it has on the remote host.

    $ curl -O https://bootstrap.pypa.io/get-pip.py
  2. Run the script with the python or python3 command to download and install the latest version of pip and other required support packages. When you include the --user switch, the script installs pip to the path ~/.local/bin.

    $ python3 get-pip.py --user

Install and update the Amazon CLI using pip

  1. Use the pip or pip3 command to install the Amazon CLI. We recommend that if you use Python version 3 or later, that you use the pip3 command.

    For the latest version of the Amazon CLI, use the following command block:

    $ pip3 install awscli --upgrade --user

    For a specific version of the Amazon CLI, append two equals signs = and the version number to the filename. For this example the filename for version 1.16.312 would be ==1.16.312 resulting in the following command:

    $ pip3 install awscli==1.16.312 --upgrade --user
    Note

    Use appropriate quoting rules for your terminal. To use the = character, you might need to use single or double quotes to escape properly. The following example escapes using single quotes:

    $ pip3 install 'awscli==1.16.312' --upgrade --user
  2. Verify that the Amazon CLI is installed correctly.

    $ aws --version aws-cli/1.25.55 Python/3.8.8 Darwin/18.7.0 botocore/1.13

    If the program isn't found, add it to your command line path.

Add the Amazon CLI version 1 executable to your macOS command line path

After installing with pip, you might need to add the aws program to your operating system's PATH environment variable. The location of the program depends on where Python is installed.

Example Amazon CLI install location - macOS with Python 3.6 and pip (user mode)

~/Library/Python/3.7/bin

Substitute the version of Python that you have for the version in the previous example.

If you don't know where Python is installed, run which python.

$ which python /usr/local/bin/python

The output might be the path to a symlink, not the actual program. Run ls -al to see where it points.

$ ls -al /usr/local/bin/python ~/Library/Python/3.7/bin/python3.7

pip installs programs in the same folder that contains the Python application. Add this folder to your PATH variable.

To modify your PATH variable

  1. Find your shell's profile script in your user directory. If you're not sure which shell you have, run echo $SHELL.

    $ ls -a ~ . .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads
    • Bash.bash_profile, .profile, or .bash_login

    • Zsh.zshrc

    • Tcsh.tcshrc, .cshrc, or .login

  2. Add an export command to your profile script.

    export PATH=~/.local/bin:$PATH

    This command adds a path, ~/.local/bin in this example, to the current PATH variable.

  3. Load the updated profile into your current session.

    $ source ~/.bash_profile

Uninstall the Amazon CLI using pip

  1. To uninstall the Amazon CLI, use pip uninstall.

    $ pip3 uninstall awscli
  2. (Optional) Remove the shared Amazon SDK and Amazon CLI settings information in the .aws folder.

    Warning

    These configuration and credentials settings are shared across all Amazon SDKs and the Amazon CLI. If you remove this folder, they cannot be accessed by any Amazon SDKs that are still on your system.

    The default location of the .aws folder differs between platforms, by default the folder is located in ~/.aws/. If your user account has write permission to this directory, you don't need to use sudo.

    $ sudo rm ~/.aws/

Troubleshooting Amazon CLI install and uninstall errors

If you come across issues after installing or uninstalling the Amazon CLI, see Troubleshooting Amazon CLI errors for troubleshooting steps. For the most relevant troubleshooting steps, see Command not found errors, The "aws --version" command returns a different version than you installed, and The "aws --version" command returns a version after uninstalling the Amazon CLI.