View a markdown version of this page

Install the AWS SAM CLI - AWS Serverless Application Model

Install the AWS SAM CLI

Install the latest release of the AWS Serverless Application Model Command Line Interface (AWS SAM CLI) on supported operating systems by following instructions in Step 1: Install the AWS CLI.

For information on managing a currently installed version of the AWS SAM CLI, including how to upgrade, uninstall, or manage nightly builds, see Managing AWS SAM CLI versions.

Is this your first time installing the AWS SAM CLI?

Complete all prerequisites in the previous section before moving forward. This includes:

  1. Signing up for an AWS account.

  2. Setting up secure access to AWS.

  3. Creating an access key ID and secret access key.

  4. Installing the AWS CLI.

  5. Configuring AWS credentials.

Installing the AWS SAM CLI

Note

Starting September 2023, AWS will no longer maintain the AWS managed Homebrew installer for the AWS SAM CLI (aws/tap/aws-sam-cli). If you use Homebrew to install and manage the AWS SAM CLI, see the following options:

To install the AWS SAM CLI, follow the instructions for your operating system.

x86_64 - command line installer
  1. Download the AWS SAM CLI .zip file to a directory of your choice.

  2. (Optional) You can verify the integrity of the installer before installation. For instructions, see Optional: Verify the integrity of the AWS SAM CLI installer.

  3. Unzip the installation files into a directory of your choice. The following is an example, using the sam-installation subdirectory.

    Note

    If your operating system doesn't have the built-in unzip command, use an equivalent.

    $ unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
  4. Install the AWS SAM CLI by running the install executable. This executable is located in the directory used in the previous step. The following is an example, using the sam-installation subdirectory:

    $ sudo ./sam-installation/install
  5. Verify the installation.

    $ sam --version

    To confirm a successful installation, you should see an output that replaces the following bracketed text with the latest available version:

     SAM CLI, <latest version>
arm64 - command line installer
  1. Download the AWS SAM CLI .zip file to a directory of your choice.

  2. (Optional) You can verify the integrity of the installer before installation. For instructions, see Optional: Verify the integrity of the AWS SAM CLI installer.

  3. Unzip the installation files into a directory of your choice. The following is an example, using the sam-installation subdirectory.

    Note

    If your operating system doesn't have the built-in unzip command, use an equivalent.

    $ unzip aws-sam-cli-linux-arm64.zip -d sam-installation
  4. Install the AWS SAM CLI by running the install executable. This executable is located in the directory used in the previous step. The following is an example, using the sam-installation subdirectory:

    $ sudo ./sam-installation/install
  5. Verify the installation.

    $ sam --version

    To confirm a successful installation, you should see an output like the following but that replaces the bracketed text with the latest SAM CLI version:

     SAM CLI, <latest version>

Installation steps

Use the package installer to install the AWS SAM CLI. Additionally, the package installer has two installation methods that you can choose from: GUI and Command line. You can install for all users or just your current user. To install for all users, superuser authorization is required.

Note

AWS SAM CLI doesn't support MacOS versions older than MacOS 13.x. Upgrade to a supported version of MacOS or install AWS SAM CLI with Homebrew.

GUI - All users
To download the package installer and install the AWS SAM CLI
Note

If you previously installed the AWS SAM CLI through Homebrew or pip, you need to uninstall it first. For instructions, see Uninstalling the AWS SAM CLI.

  1. Download the macOS pkg to a directory of your choice:

    Note

    You have the option of verifying the integrity of the installer before installation. For instructions, see Optional: Verify the integrity of the AWS SAM CLI installer.

  2. Run your downloaded file and follow the on-screen instructions to continue through the Introduction, Read Me, and License steps.

  3. For Destination Select, select Install for all users of this computer.

  4. For Installation Type, choose where the AWS SAM CLI will be installed and press Install. The recommended default location is /usr/local/aws-sam-cli.

    Note

    To invoke the AWS SAM CLI with the sam command, the installer automatically creates a symlink between /usr/local/bin/sam and either /usr/local/aws-sam-cli/sam or the installation folder you chose.

  5. The AWS SAM CLI will install and The installation was successful message will display. Press Close.

To verify a successful installation
  • Verify that the AWS SAM CLI has properly installed and that your symlink is configured by running:

    $ which sam /usr/local/bin/sam $ sam --version SAM CLI, <latest version>
GUI - Current user
To download and install the AWS SAM CLI
Note

If you previously installed the AWS SAM CLI through Homebrew or pip, you need to uninstall it first. For instructions, see Uninstalling the AWS SAM CLI.

  1. Download the macOS pkg to a directory of your choice:

    Note

    You have the option of verifying the integrity of the installer before installation. For instructions, see Optional: Verify the integrity of the AWS SAM CLI installer.

  2. Run your downloaded file and follow the on-screen instructions to continue through the Introduction, Read Me, and License steps.

  3. For Destination Select, select Install for me only. If you don't see this option, go to the next step.

  4. For Installation Type, do the following:

    1. Choose where the AWS SAM CLI will be installed. The default location is /usr/local/aws-sam-cli. Select a location that you have write permissions for. To change the installation location, select local and choose your location. Press Continue when done.

    2. If you didn't get the option to choose Install for me only in the previous step, select Change Install Location > Install for me only and press Continue.

    3. Press Install.

  5. The AWS SAM CLI will install and The installation was successful message will display. Press Close.

To create a symlink
  • To invoke the AWS SAM CLI with the sam command, you must manually create a symlink between the AWS SAM CLI program and your $PATH. Create your symlink by modifying and running the following command:

    $ sudo ln -s /path-to/aws-sam-cli/sam /path-to-symlink-directory/sam
    • sudo – If your user has write permissions to $PATH, sudo is not required. Otherwise, sudo is required.

    • path-to – Path to where you installed the AWS SAM CLI program. For example, /Users/myUser/Desktop.

    • path-to-symlink-directory – Your $PATH environment variable. The default location is /usr/local/bin.

To verify a successful installation