All Products
Search
Document Center

Alibaba Cloud CLI:Install, update, and uninstall Alibaba Cloud CLI

Last Updated:May 22, 2026

Alibaba Cloud CLI lets you manage cloud resources from a terminal. This topic covers installation, updates, and uninstallation on Linux, macOS, and Windows.

Version information

The latest Alibaba Cloud CLI version is 3.3.14. View release notes on the GitHub Releases page.

Versions earlier than 3.3.0 are end-of-life and no longer receive updates or security fixes. If you are running one, use the migration guide to upgrade.

Prerequisites

  • You have an Alibaba Cloud account. Create an account if needed.

  • (Optional) curl is installed. Most macOS and Linux systems include it by default. Not required for GUI or package manager installs.

Supported systems

Operating system

Supported versions

Supported architectures

Linux

Major distributions including CentOS 7+, Ubuntu 16.04+, Debian 9+

AMD64, ARM64

macOS

macOS 11 (Big Sur) and later

Intel and Apple Silicon (Universal)

Windows

Windows 10 and later (64-bit)

AMD64 only (32-bit and ARM64 are not supported)

Install Alibaba Cloud CLI

Select your operating system and preferred installation method.

Linux

Use the Bash script for a quick one-command install; use the TGZ package for air-gapped environments or custom install paths.

Use a Bash script

The script detects your architecture, downloads the correct package, and places the aliyun binary in /usr/local/bin/.

  • Install the latest version

    /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
  • Install a specific version

    Check GitHub Releases for available versions.

    Important

    Versions earlier than 3.3.0 are end-of-life and no longer receive updates or security fixes.

    /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" -- -V 3.0.277

Use a TGZ package (compressed tar archive)

  1. Download the installation package that matches your system architecture.

    Note

    Run uname -m to check your architecture. arm64 or aarch64 indicates ARM64. Other output indicates AMD64.

    • Download for Linux AMD64:

      curl https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o aliyun-cli-linux-latest.tgz
    • Download for Linux ARM64:

      curl https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz -o aliyun-cli-linux-latest.tgz
    • Download a specific version: Visit the GitHub Releases page. The package name format is aliyun-cli-linux-<version>-<architecture>.tgz.

      Important

      Versions earlier than 3.3.0 are end-of-life and no longer receive updates or security fixes.

  2. Extract the package to obtain the aliyun binary.

    tar xzvf aliyun-cli-linux-latest.tgz
  3. Move the binary to /usr/local/bin for global access.

    sudo mv ./aliyun /usr/local/bin/

macOS

Use a graphical installer (GUI, recommended)

  1. Download the PKG (macOS installer package).

  2. Double-click the downloaded PKG file and follow the on-screen instructions to complete the installation.

    Note

    If macOS blocks the installer with a security warning, open System Settings > Privacy & Security and click Open Anyway to proceed.

Use Homebrew

Note

Ensure Homebrew is installed before proceeding.

To install the latest version, run:

brew install aliyun-cli

Use a Bash script

The script detects macOS and downloads the universal binary automatically.

  • Install the latest version

    /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
  • Install a specific version

    Check GitHub Releases for available versions.

    Important

    Versions earlier than 3.3.0 are end-of-life and no longer receive updates or security fixes.

    /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" -- -V 3.0.277

Use a TGZ package

  1. Download the installation package.

    • Latest version:

      curl https://aliyuncli.alicdn.com/aliyun-cli-macosx-latest-universal.tgz -o aliyun-cli-macosx-latest-universal.tgz
    • Specific version: Visit the GitHub Releases page. The package name format is aliyun-cli-macosx-<version>-universal.tgz.

      Important

      Versions earlier than 3.3.0 are end-of-life and no longer receive updates or security fixes.

  2. Extract the package to obtain the aliyun binary.

    tar xzvf aliyun-cli-macosx-latest-universal.tgz
  3. Move the binary to /usr/local/bin for global access.

    sudo mv ./aliyun /usr/local/bin

Windows

Important

Alibaba Cloud CLI runs only on Windows AMD64 systems. 32-bit and other non-AMD64 architectures (including ARM64) are not supported.

Use the PowerShell script for automated installs; use the ZIP package for manual or portable installs.

Use a ZIP package

  1. Download the installation package.

  2. Extract aliyun.exe from the ZIP file to a directory of your choice. This directory serves as the Alibaba Cloud CLI installation directory.

    Note

    Run aliyun.exe from a command-line terminal. Double-clicking the executable has no effect.

  3. Press Windows + S to open the Windows search bar, then type "environment variables".

  4. In the search results, click Edit the environment variables for your account to open the Environment Variables dialog box.

  5. Under User variables, select the Path variable, and then click Edit.

  6. Click New, and enter the Alibaba Cloud CLI installation directory path. For example: C:\ExampleDir (replace with your actual installation path).

    image

  7. Click OK in each open dialog box to save the changes.

  8. Restart your terminal for the changes to take effect.

Use a PowerShell script

  1. Create a file named Install-CLI-Windows.ps1 and paste the following script into it.

    Sample script

    # Install-CLI-Windows.ps1
    # Purpose: Install Alibaba Cloud CLI on Windows AMD64 systems.
    # Supports custom version and install directory. Only modifies User-level and Process-level PATH.
    
    [CmdletBinding()]
    param (
        [string]$Version = "latest",
        [string]$InstallDir = "$env:LOCALAPPDATA",
        [switch]$Help
    )
    
    function Show-Usage {
        Write-Output @"
    
          Alibaba Cloud Command Line Interface Installer
    
        -Help                 Display this help and exit
    
        -Version VERSION      Custom CLI version. Default is 'latest'
    
        -InstallDir PATH      Custom installation directory. Default is:
                              $InstallDir\AliyunCLI
    
    "@
    }
    
    function Write-ErrorExit {
        param([string]$Message)
        Write-Error $Message
        exit 1
    }
    
    if ($PSBoundParameters['Help']) {
        Show-Usage
        exit 0
    }
    
    Write-Output @"
    ..............888888888888888888888 ........=8888888888888888888D=..............
    ...........88888888888888888888888 ..........D8888888888888888888888I...........
    .........,8888888888888ZI: ...........................=Z88D8888888888D..........
    .........+88888888 ..........................................88888888D..........
    .........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D..........
    .........+88888888 ............. ************* ..............O8888888D..........
    .........+88888888 .... Command Line Interface(Reloaded) ....O8888888D..........
    .........+88888888...........................................88888888D..........
    ..........D888888888888DO+. ..........................?ND888888888888D..........
    ...........O8888888888888888888888...........D8888888888888888888888=...........
    ............ .:D8888888888888888888.........78888888888888888888O ..............
    "@
    
    $OSArchitecture = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture
    
    $ProcessorArchitecture = [int](Get-WmiObject -Class Win32_Processor).Architecture
    
    if (-not ($OSArchitecture -match "64") -or $ProcessorArchitecture -ne 9) {
        Write-ErrorExit "Alibaba Cloud CLI only supports Windows AMD64 systems. Please run on a compatible system."
    }
    
    $DownloadUrl = "https://aliyuncli.alicdn.com/aliyun-cli-windows-$Version-amd64.zip"
    
    $tempPath = $env:TEMP
    $randomName = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 8)
    $DownloadDir = Join-Path -Path $tempPath -ChildPath $randomName
    New-Item -ItemType Directory -Path $DownloadDir | Out-Null
    
    try {
        $InstallDir = Join-Path $InstallDir "AliyunCLI"
        if (-not (Test-Path $InstallDir)) {
            New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
        }
    
        $ZipPath = Join-Path $DownloadDir "aliyun-cli.zip"
        Start-BitsTransfer -Source $DownloadUrl -Destination $ZipPath
    
        Expand-Archive -Path $ZipPath -DestinationPath $DownloadDir -Force
    
        Move-Item -Path "$DownloadDir\aliyun.exe" -Destination "$InstallDir\" -Force
    
        $Key = 'HKCU:\Environment'
        $CurrentPath = (Get-ItemProperty -Path $Key -Name PATH).PATH
    
        if ([string]::IsNullOrEmpty($CurrentPath)) {
            $NewPath = $InstallDir
        } else {
            if ($CurrentPath -notlike "*$InstallDir*") {
                $NewPath = "$CurrentPath;$InstallDir"
            } else {
                $NewPath = $CurrentPath
            }
        }
    
        if ($NewPath -ne $CurrentPath) {
            Set-ItemProperty -Path $Key -Name PATH -Value $NewPath
            $env:PATH += ";$InstallDir"
        }
    } catch {
        Write-ErrorExit "Failed to install Alibaba Cloud CLI: $_"
    } finally {
        Remove-Item -Path $DownloadDir -Recurse -Force | Out-Null
    }
  2. Run the script to install Alibaba Cloud CLI.

    Note

    The example script path is C:\Example\Install-CLI-Windows.ps1. Replace it with your actual script path.

    • Install the latest version. The default installation path is C:\Users\<USERNAME>\AppData\Local\AliyunCLI.

      powershell.exe -ExecutionPolicy Bypass -File C:\Example\Install-CLI-Windows.ps1
    • Specify a version (from GitHub Releases) and installation directory.

      powershell.exe -ExecutionPolicy Bypass -File C:\Example\Install-CLI-Windows.ps1 -Version 3.0.277 -InstallDir "C:\ExampleDir\AliyunCLI"

Verify the installation

Confirm the installation:

aliyun version

A version number output (e.g., 3.3.14) confirms a successful installation.

If the command returns command not found or an unexpected version, see FAQ below.

Update Alibaba Cloud CLI

Update using the same method you used for the initial installation.

Locate your current installation

If you are unsure how CLI was installed, locate the binary:

  • Linux/macOS: Run which aliyun. The output is the path to the executable.

    • Path contains /homebrew/ or /linuxbrew/ → installed via Homebrew. Use the Homebrew update method.

    • Path is /usr/local/bin/aliyun → installed via Bash script or TGZ package to the default directory.

    • Other path → installed via TGZ package to a custom directory. Note the path and use the TGZ update method.

  • Windows: Run where aliyun.exe in Command Prompt. The output is the path to the executable.

    • Path is %LOCALAPPDATA%\AliyunCLI\aliyun.exe → installed via PowerShell script (default path).

    • Other path → installed via GUI installer (ZIP) to the directory you chose.

Version upgrade path

Run aliyun version to check your current version, then follow the appropriate path:

  • Version 3.3.0 or later: Update directly using the method that matches your installation.

  • Version earlier than 3.3.0: Do not update directly. See the migration guide to complete the upgrade first.

Update methods

Choose the method that matches your initial installation:

  • Bash script (Linux/macOS): Re-run the installation script to update to the latest version.

    /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
  • Homebrew (macOS only): To update, run:

    brew update && brew upgrade aliyun-cli && brew cleanup aliyun-cli
  • PKG installer (macOS) / ZIP package (Windows):

  • TGZ package (Linux/macOS): Follow steps 1–3 in the Linux > Use a TGZ package or macOS > Use a TGZ package installation section, using the same target directory as your original installation to overwrite the existing binary.

  • PowerShell script (Windows only): Re-run the PowerShell installation script with the same parameters you used originally. The script will download the latest version and overwrite the existing installation.

    powershell.exe -ExecutionPolicy Bypass -File <script_path> [-InstallDir <install_path>]
    Note

    Add -Version <version> to update to a specific version. Omit it to install the latest release. Check GitHub Releases for available versions.

Notes

  • If you used a custom installation directory, specify the same directory when updating.

  • Fully uninstall and reinstall if: you are unsure of your installation method, need to switch methods, or need to change the install directory.

Verify the update

Confirm the update:

aliyun version

Uninstall Alibaba Cloud CLI

Linux

Use the command line

  1. Remove the aliyun binary:

    sudo sh -c "which aliyun | xargs -r rm -v"
  2. If you installed to a custom directory, remove that directory from the PATH environment variable. Open your shell configuration file (for example, ~/.bashrc for Bash or ~/.zshrc for Zsh) and delete the line that adds the Alibaba Cloud CLI directory to PATH. Then reload the configuration:

    source ~/.bashrc
    Note

    Replace ~/.bashrc with ~/.zshrc if your default shell is Zsh.

Use a Bash script

  1. Create a script file and paste the following content into it.

    Sample script

    #!/usr/bin/env bash
    
    set -euo pipefail
    
    show_help() {
    cat << EOF
    
          Alibaba Cloud Command Line Interface Uninstaller
    
        -h          Display this help and exit
    
        -C          Remove user config file
    
    EOF
    }
    
    abort() {
      printf "%s\n" "$@" >&2
      exit 1
    }
    
    CLEAN_CONFIG=false
    
    while getopts ":hC" opt; do
      case "$opt" in
        "h")
          show_help
          exit 0
          ;;
        "C")
          CLEAN_CONFIG=true
          ;;
        *)
          echo "Unexpected flag not supported"
          exit 1
          ;;
      esac
    done
    
    echo -e "
    ..............888888888888888888888 ........=8888888888888888888D=..............
    ...........88888888888888888888888 ..........D8888888888888888888888I...........
    .........,8888888888888ZI: ...........................=Z88D8888888888D..........
    .........+88888888 ..........................................88888888D..........
    .........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D..........
    .........+88888888 ............. ************* ..............O8888888D..........
    .........+88888888 .... Command Line Interface(Reloaded) ....O8888888D..........
    .........+88888888...........................................88888888D..........
    ..........D888888888888DO+. ..........................?ND888888888888D..........
    ...........O8888888888888888888888...........D8888888888888888888888=...........
    ............ .:D8888888888888888888.........78888888888888888888O ..............
    "
    
    USER_CONFIG_DIR="${HOME}/.aliyun"
    CONFIG_FILE_PATH="${USER_CONFIG_DIR}/config.json"
    
    remove_aliyun_binary() {
      local binary
      binary=$(which aliyun)
    
      if [ -n "$binary" ]; then
        rm -vf "$binary"
        rmdir --ignore-fail-on-non-empty "$(dirname "$binary")" 2>/dev/null || true
      fi
    }
    
    remove_user_config() {
      if $CLEAN_CONFIG; then
        rm -f "${CONFIG_FILE_PATH}" || abort "Failed to remove config file: ${CONFIG_FILE_PATH}"
    
        if [ -d "${USER_CONFIG_DIR}" ]; then
          rmdir --ignore-fail-on-non-empty "${USER_CONFIG_DIR}" 2>/dev/null || true
        fi
      fi
    }
    
    remove_aliyun_binary
    remove_user_config
    
    echo "Aliyun CLI has been uninstalled."
  2. Run the script:

    # Uninstall only the executable file
    bash <script_path>
    
    # Uninstall the executable file and delete the configuration file
    bash <script_path> -C
    
    # View script help
    bash <script_path> -h

macOS

Use Homebrew

Run the following command to uninstall:

brew uninstall aliyun-cli

Use the command line

  1. Remove the aliyun binary:

    BINARY=$(which aliyun 2>/dev/null) && [ -n "$BINARY" ] && sudo rm -v "$BINARY"
  2. If you installed to a custom directory, remove that directory from the PATH environment variable. Open your shell configuration file (~/.bashrc for Bash or ~/.zshrc for Zsh) and delete the line that adds the Alibaba Cloud CLI directory. Then reload the configuration:

    source ~/.zshrc
    Note

    Replace ~/.zshrc with ~/.bashrc if you use Bash.

Windows

Use File Explorer

  1. Open File Explorer, navigate to the Alibaba Cloud CLI installation directory, and delete the aliyun.exe file.

  2. Press the Windows key, then type "environment variables" in the search box.

  3. In the search results, click Edit the environment variables for your account to open the Environment Variables dialog box.

  4. Under User variables, select the Path variable, and then click Edit.

  5. Select the Alibaba Cloud CLI installation directory entry, click Delete to remove it from Path. For example: C:\ExampleDir (replace with your actual installation path).

    image

  6. Click OK in each open dialog box to save the changes.

Use a PowerShell script

  1. Create a script file and paste the following content into it.

    Sample script

    # Uninstall-CLI-Windows.ps1
    # Purpose: Automatically detect and uninstall Aliyun CLI, and delete configuration files in user directory
    
    [CmdletBinding()]
    param (
        [switch]$Clean,
        [switch]$Help
    )
    
    function Show-Usage {
        Write-Output @"
    
          Alibaba Cloud Command Line Interface Uninstaller
    
        -Help                 Display this help and exit
    
        -Clean                Remove user config file
    
    "@
    }
    
    function Remove-DirectoryIfEmpty {
        param([string]$Path)
        if ((Get-ChildItem -Path $Path -Force).Count -eq 0) {
            Remove-Item -Path $Path -Force
        }
    }
    
    function Remove-AliyunCLIFromPath {
        param([string]$PathToRemove)
        $Key = 'HKCU:\Environment'
        $CurrentPath = (Get-ItemProperty -Path $Key -Name PATH).PATH
        if ($CurrentPath -like "*$PathToRemove*") {
            $newPath = ($CurrentPath -split ';' | Where-Object { $_ -ne $PathToRemove }) -join ';'
            Set-ItemProperty -Path $Key -Name PATH -Value $newPath
            $env:PATH = $newPath
        }
    }
    
    function Remove-AliyunCLI {
        $AliyunBinary = (Get-Command aliyun -ErrorAction SilentlyContinue).Source
        if ($AliyunBinary -and (Test-Path $AliyunBinary)) {
            Remove-Item -Path $AliyunBinary -Force
            $AliyunInstallDir = Split-Path -Parent $AliyunBinary
            Remove-DirectoryIfEmpty -Path $AliyunInstallDir
            Remove-AliyunCLIFromPath -PathToRemove $AliyunInstallDir
            Write-Output "Aliyun CLI binary has been removed."
        }
    }
    
    function Remove-ConfigFile {
        $ConfigDir = Join-Path $HOME ".aliyun"
        $ConfigFile = Join-Path $ConfigDir "config.json"
        if (Test-Path $ConfigFile) {
            Remove-Item -Path $ConfigFile -Force
            Remove-DirectoryIfEmpty -Path $ConfigDir
            Write-Output "Aliyun CLI config file has been removed."
        }
    }
    
    if ($PSBoundParameters['Help']) {
        Show-Usage
        exit 0
    }
    
    Write-Output @"
    ..............888888888888888888888 ........=8888888888888888888D=..............
    ...........88888888888888888888888 ..........D8888888888888888888888I...........
    .........,8888888888888ZI: ...........................=Z88D8888888888D..........
    .........+88888888 ..........................................88888888D..........
    .........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D..........
    .........+88888888 ............. ************* ..............O8888888D..........
    .........+88888888 .... Command Line Interface(Reloaded) ....O8888888D..........
    .........+88888888...........................................88888888D..........
    ..........D888888888888DO+. ..........................?ND888888888888D..........
    ...........O8888888888888888888888...........D8888888888888888888888=...........
    ............ .:D8888888888888888888.........78888888888888888888O ..............
    "@
    
    try {
        Remove-AliyunCLI
        if ($PSBoundParameters['Clean']) { Remove-ConfigFile }
        Write-Output "Aliyun CLI has been uninstalled."
    } catch {
        Write-Output "Failed to uninstall Aliyun CLI: $_"
    }
  2. Run the script:

    # Uninstall only the executable file
    powershell.exe -ExecutionPolicy Bypass -File <script_path>
    
    # Uninstall the executable file and delete the configuration file
    powershell.exe -ExecutionPolicy Bypass -File <script_path> -Clean
    
    # View script help
    powershell.exe -ExecutionPolicy Bypass -File <script_path> -Help

Delete configuration files (optional)

CLI configuration is stored in the .aliyun directory under your user profile. Delete it to fully remove all CLI data:

  • Linux/macOS: ~/.aliyun

  • Windows: C:\Users\<USERNAME>\.aliyun

FAQ

Why does the aliyun command return "command not found" after installation?

The aliyun binary is not in your PATH or was not installed. Locate the binary to confirm:

  • Linux/macOS: Run which aliyun. If a path is returned, the binary exists but its directory is not in PATH. If no path is returned, the binary was not installed. Retry the installation using one of the methods in the Install section.

  • Windows: Run where aliyun in Command Prompt. If a path is returned, the binary exists but its directory is not in PATH. If no path is returned, the binary was not installed. Retry the installation using one of the methods in the Install section.

If the binary is found, add its directory to PATH for your shell:

  • Bash: Add export PATH="$PATH:/your/install/dir" to ~/.bashrc, then run source ~/.bashrc.

  • Zsh: Add the same line to ~/.zshrc, then run source ~/.zshrc.

  • Windows: Follow steps 3–8 in the Windows > Use a ZIP package installation section to add the installation directory to the Path environment variable, then restart your terminal.

Why does "aliyun version" show a different version than what I just installed?

Multiple aliyun binaries may exist. Run which aliyun (Linux/macOS) or where aliyun (Windows) to check which one your shell resolves. If it points to an older installation, delete the old binary or reorder PATH directories so the new installation takes precedence. Restart your terminal and re-run aliyun version to confirm.

Why does the installation fail with "Permission denied"?

System directories like /usr/local/bin require administrator privileges. On Linux/macOS, prefix the command with sudo (e.g., sudo mv ./aliyun /usr/local/bin/). On Windows, run PowerShell as administrator.

Homebrew installation or update times out on macOS

GitHub CDN access can be slow in mainland China. Configure a domestic Homebrew mirror (e.g., USTC) as shown in the macOS > Homebrew section. To persist the settings, add the export lines to ~/.zshrc or ~/.bashrc and run source ~/.zshrc. Retry the Homebrew command after configuring the mirror.

Why doesn't anything happen when I double-click aliyun.exe on Windows?

Alibaba Cloud CLI is a command-line tool with no graphical interface. Double-clicking the executable opens and immediately closes a window. Open Command Prompt or PowerShell, navigate to the directory containing aliyun.exe (or add it to PATH), and run commands from there.

Next steps

  • Quick start: Configure credentials and run your first command.

  • Configure credentials: Set up access credentials for Alibaba Cloud CLI.

  • Migration guide: If your current version is earlier than 3.3.0, follow the migration guide to upgrade to the latest version.