All Products
Search
Document Center

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

Last Updated:Jun 04, 2026

This topic describes how to install, verify, update, and uninstall Alibaba Cloud CLI on Linux, macOS, and Windows.

Version information

Alibaba Cloud CLI releases new versions regularly. We recommend that you always use the latest version for the best experience. Run aliyun version to check your current version. Visit the GitHub Releases page for the latest version and release notes.

Important

Versions earlier than 3.3.0 have reached end of life (EOL) and no longer receive feature updates or security fixes. If your version is below 3.3.0, see the migration guide to upgrade.

Prerequisites

  • You have an Alibaba Cloud account.

  • (Optional) The curl command-line tool. Most macOS and Linux distributions include it by default. You can skip this requirement if you install through a package manager or a graphical installer.

Supported operating systems

Operating system

Supported versions

Supported architectures

Linux

CentOS 8+, RHEL 8+, Ubuntu 16.04+, Debian 9+, and other major distributions. CentOS 7 has reached EOL and is not recommended.

x86_64 (64-bit), ARM64

macOS

macOS 11 (Big Sur) or later

Intel and Apple silicon (Universal binary)

Windows

Windows 10 and later (64-bit)

x86_64 only. 32-bit and ARM64 are not supported.

Install Alibaba Cloud CLI

Select your operating system, then choose an installation method.

Linux

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

Use a Bash script (recommended)

The script detects your system 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

    Use the -V flag to specify a version. Check GitHub Releases for available versions.

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

Use a .tar.gz package

  1. Download the package that matches your system architecture.

    Note

    Run uname -m to check your architecture. arm64 or aarch64 indicates ARM64; other output indicates x86_64.

    • x86_64 (64-bit):

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

      curl https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz -o aliyun-cli-linux-latest.tgz
    • To download a specific version, visit the GitHub Releases page. Package names follow the format aliyun-cli-linux-<version>-<arch>.tgz, where <arch> is amd64 or arm64.

  2. Extract the package.

    tar xzvf aliyun-cli-linux-latest.tgz
  3. Move the binary to a directory in your PATH.

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

macOS

Use Homebrew (recommended)

Note

Homebrew must be installed before you proceed.

Install the latest version:

brew install aliyun-cli

Use the macOS installer (.pkg)

  1. Download the installer.

  2. Double-click the downloaded .pkg file and follow the on-screen instructions.

    Note

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

Use a Bash script

The script detects macOS and downloads the universal binary automatically. The commands are the same as on Linux.

  • 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.

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

Use a .tar.gz package

  1. Download the 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. Package names follow the format aliyun-cli-macosx-<version>-universal.tgz.

  2. Extract the package.

    tar xzvf aliyun-cli-macosx-latest-universal.tgz
  3. Move the binary to a directory in your PATH.

    sudo mv ./aliyun /usr/local/bin

Windows

Important

Alibaba Cloud CLI supports only x86_64 (64-bit) Windows systems. 32-bit and ARM64 systems are not supported.

Use the ZIP package for a quick manual install, or use the PowerShell script for automated installs.

Use a ZIP package

  1. Download the package.

  2. Extract aliyun.exe to a directory of your choice. For example, C:\AliyunCLI.

    Note

    aliyun.exe is a command-line tool. Double-clicking it has no effect. Run it from a terminal (Command Prompt or PowerShell).

  3. Press Windows + S and search for environment variables.

  4. Click Edit the environment variables for your account.

  5. Under User variables, select Path and click Edit.

  6. Click New and enter the directory path (for example, C:\AliyunCLI).

    image

  7. Click OK in each dialog to save.

  8. Restart your terminal for the change 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.3.18 -InstallDir "C:\ExampleDir\AliyunCLI"

Verify the installation

Open a new terminal and run:

aliyun version

A version number such as 3.3.18 confirms a successful installation.

To further verify that the CLI works correctly:

aliyun configure list

This displays your credential profiles, even if the list is empty.

If the command returns command not found, see Troubleshooting.

After installation, configure your access credentials to start using Alibaba Cloud CLI:

Update Alibaba Cloud CLI

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

Determine your installation method

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

  • Linux/macOS: Run which aliyun.

    • Path contains /homebrew/ or /linuxbrew/ → Homebrew.

    • Path is /usr/local/bin/aliyun → Bash script or .tar.gz package.

    • Other path → .tar.gz package to a custom directory.

  • Windows: Run where aliyun.exe in Command Prompt.

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

    • Other path → ZIP package to a custom directory.

Check your version

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

  • Version 3.3.5 or later: Use aliyun upgrade (recommended) or reinstall.

  • Version 3.3.0 to 3.3.4: Reinstall to update. After reaching 3.3.5+, use aliyun upgrade for future updates.

  • Version earlier than 3.3.0: See the migration guide to upgrade first.

Use aliyun upgrade (recommended)

Available in version 3.3.5 and later. This command downloads and installs the latest version.

  • Update to the latest version:

    aliyun upgrade
  • To skip the confirmation prompt:

    aliyun upgrade --yes
Note

aliyun upgrade does not apply to Homebrew installations. Use brew upgrade aliyun-cli instead.

Update by reinstalling

Choose the method that matches your original 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):

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

    • macOS installer (.pkg): Download the latest .pkg and run it. The new binary overwrites the previous installation.

    • ZIP package (Windows): Download the latest .zip, extract aliyun.exe, and replace the existing binary. No PATH changes needed.

  • .tar.gz package (Linux/macOS): Download the latest package, extract, and move the binary to the same directory as your original installation.

  • PowerShell script (Windows): Re-run the script with the same parameters. Add -Version <version> to install a specific version.

    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.

  • If you need to switch installation methods or change the install directory, fully uninstall first, then reinstall.

Verify the update

Confirm the update was successful:

aliyun version

Uninstall Alibaba Cloud CLI

Linux

Use the command line

  1. Locate and remove the binary:

    sudo rm -v "$(which aliyun)"
  2. If you installed to a custom directory and added it to PATH, remove that entry from your shell configuration file (~/.bashrc for Bash or ~/.zshrc for Zsh) and reload:

    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

Uninstall Alibaba Cloud CLI:

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 and added it to PATH, remove that entry from ~/.zshrc (or ~/.bashrc) and reload:

    source ~/.zshrc
    Note

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

Windows

Use File Explorer

  1. Navigate to the installation directory and delete aliyun.exe.

  2. Press Windows + S and search for environment variables.

  3. Click Edit the environment variables for your account.

  4. Under User variables, select Path and click Edit.

  5. Select the Alibaba Cloud CLI directory entry and click Delete.

    image

  6. Click OK in each dialog to save.

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

Remove configuration files (optional)

Alibaba Cloud CLI stores configuration in the .aliyun directory under your user home directory. Delete it to fully remove all CLI data:

  • Linux/macOS: ~/.aliyun

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

Troubleshooting

The aliyun command returns "command not found"

The aliyun binary is not in your PATH or was not installed correctly.

  • 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.

aliyun version shows a different version than expected

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

Installation fails with "Permission denied"

System directories such as /usr/local/bin require administrator privileges. On Linux and macOS, prefix the command with sudo (for example, sudo mv ./aliyun /usr/local/bin/). On Windows, run PowerShell as an administrator.

Homebrew installation or update times out on macOS

This typically happens due to slow network access to the GitHub CDN. Configure a domestic Homebrew mirror such as USTC, as described in the Homebrew installation section. To persist the mirror settings, add the export lines to ~/.zshrc (or ~/.bashrc) and run source ~/.zshrc.

Double-clicking aliyun.exe on Windows has no effect

Alibaba Cloud CLI is a command-line tool with no graphical interface. Open Command Prompt or PowerShell, navigate to the directory containing aliyun.exe (or ensure it is in your PATH), and run commands from there.