Information for: DEVELOPERS   PARTNERS   SUPPORT

Installing Acquia CLI

Use the information on this page to install Acquia CLI in your development environment.

Note

Acquia CLI is distributed only as a self-contained Phar archive. It should not be installed through Composer, as this can create dependency conflicts.

Requirements

Acquia CLI requires PHP 7.4 or later with the PHP-JSON and PHP-PHAR extensions enabled. Acquia CLI will warn you if these requirements are not met.

Some commands require a Cloud Platform account. Acquia CLI will prompt you to link your Cloud Platform account when running commands that require it (see Authenticating with Acquia Cloud Platform API).

Installation Procedure

Open up your Terminal application and type the following commands to automatically install Acquia CLI. Remember to press Enter on your keyboard to execute each command.

  1. Download the appropriate version of Acquia CLI based on the PHP version:

    • For PHP 8.0 or later, download the latest version of Acquia CLI:

      curl -OL https://github.com/acquia/cli/releases/latest/download/acli.phar
      
    • For PHP 7.4, download the version 1.30.1 specifically:

      curl -OL https://github.com/acquia/cli/releases/download/1.30.1/acli.phar
      
  2. Make the file executable.

    chmod +x acli.phar
    
  3. Rename the file and move it to a location that is globally accessible.

    This step allows you to type acli from anywhere on your system.

    Note

    The following command may require the use of sudo on some systems. If it fails for you, prefix the command with sudo. When prompted for a password, specify your password.

    mv acli.phar /usr/local/bin/acli
    

Run acli from anywhere on your system to view the installed version of Acquia CLI and a list of commands.

Note

Acquia CLI does not require the Windows Subsystem for Linux (WSL). It runs natively in any environment that has the necessary version of PHP and extensions.

  1. Download the appropriate version of Acquia CLI based on the PHP version:

    • For PHP 8.0 or later, download the latest acli.phar file from the releases page and place it in the directory where you want to run Acquia CLI.
    • For PHP 7.4, download the version 1.30.1 specifically.
  2. Open a command-line interface and run php acli.phar.

    You can view the installed version of Acquia CLI and a list of commands. If you run into a SSL certificate issue, review this known issue.

    In CMD and Powershell, Phar files including Acquia CLI must be run using the PHP CLI interpreter in the directory where the Phar is installed. To instead run Acquia CLI as an executable from another directory, create a batch script such as the following:

    @ECHO OFF
    php %~dp0acli.phar %*
    

Acquia CLI is best installed through a Phar file. The following is an advanced procedure, so you must use this procedure only when you cannot install Acquia CLI natively or when you create a custom Docker image on top of it.

For more information about Docker, read the docs.

Note

For all commands that need to invoke the Cloud Platform API, you must prefix commands with your API token and secret as environment variables.

  1. Clone the Acquia CLI Git repository and navigate into it.

    git clone [email protected]:acquia/cli.git
    cd cli
    
  2. Build the Docker image:

    docker build -t acli .
    

    To run Acquia CLI commands, do one of the following:

    • Create a container that gets destroyed immediately after you run a command:

      docker run -e ACLI_KEY=<key> \
                 -e ACLI_SECRET=<secret> \
                 -it acli \
                 php /usr/local/bin/acli -n <command>
      
    • Run the commands interactively:

      docker run -it acli sh
      / # ACLI_KEY=<key> ACLI_SECRET=<secret> acli -n <command1>
      / # ACLI_KEY=<key> ACLI_SECRET=<secret> acli -n <command2>
      

Note

On certain systems or PHP builds where the php-phar extension is not installed, you cannot run acli. Ensure that you install or compile with the extension if PHP returns Class 'Phar' not found.

After installing Acquia CLI, proceed to Getting started with Acquia CLI.

Unstable releases

To enable a larger audience to test new features, Acquia might publish unstable releases such as Alpha or Beta.

Note

Preview releases may contain critical bugs. Therefore, use them at your own risk.

To allow Acquia CLI to download unstable releases, run the following command:

$ acli self-update --preview
Downloading Acquia CLI (acquia/cli) 1.30.0-beta1
Download finished
Successfully updated acli

To revert Acquia CLI to downloading stable releases only, run the following command:

$ acli self-update --stable
Downloading Acquia CLI (acquia/cli) 1.30.0
Download finished
Successfully updated acli