Project: KubeBlocks by ApeCloud (App Definition and Development / Database)
File: install-kbcli.md

title: Install kbcli description: Install kbcli keywords: [install, kbcli,] sidebar_position: 2 sidebar_label: Install kbcli import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; You can install kbcli on your laptop or virtual machines on the cloud. For Windows users, PowerShell version should be 5.0 or higher. kbcli now supports macOS, Windows, and Linux. <Tabs> <TabItem value="macOS" label="macOS" default> You can install kbcli with `curl` or `brew`. Option 1: Install kbcli using the `curl` command. Install kbcli. ```bash curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash ``` If you want to install kbcli with a specified version, follow the steps below. Check the available versions in . Specify a version with `-s` and run the command below. ```bash curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s x.x.x ``` :::note By default, kbcli installs the latest release version and then when installing KubeBlocks, kbcli installs the matched version. Ensure that the major versions of kbcli and KubeBlocks match. For instance, you can install kbcli v0.6.1 and KubeBlocks v0.6.3, but mismatched versions like kbcli v0.5.0 and KubeBlocks v0.6.0 may result in errors. ::: Run `kbcli version` to check the version of kbcli and ensure that it is successfully installed. :::note If a timeout exception occurs during installation, please check your network settings and retry. ::: Option 2: Install kbcli using Homebrew. Install ApeCloud tap, the Homebrew package of ApeCloud. ```bash brew tap apecloud/tap ``` Install kbcli. ```bash brew install kbcli ``` If you want to install kbcli with a specified version, run the commands below. ```bash brew search kbcli brew install kbcli@x.x.x ``` Verify that kbcli is successfully installed. ```bash kbcli -h ``` </TabItem> <TabItem value="Windows" label="Windows"> There are two ways to install kbcli on Windows: Option 1: Install using the script. :::note By default, the script will be installed at C:\Program Files\kbcli-windows-amd64 and cannot be modified. If you need to customize the installation path, use the zip file. ::: Run PowerShell as an administrator and execute `Set-ExecutionPolicy Unrestricted`. Install kbcli. The following script will automatically install the environment variables at C:\Program Files\kbcli-windows-amd64. ```bash powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1)))" ``` To install a specified version of kbcli, use `-v` after the command and describe the version you want to install. ```bash powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1))) -v 0.5.2" ``` Option 2: Install using the installation package. Download the kbcli installation zip package from . Extract the file and add it to the environment variables. Click the Windows icon and select System Settings. Click Settings -> Related Settings -> Advanced system settings. Click Environment Variables on the Advanced tab. Click New to add the path of the kbcli installation package to the user and system variables. Click Apply and OK. </TabItem> <TabItem value="Linux" label="Linux"> Install kbcli using the `curl` command. Install kbcli. ```bash curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash ``` Run `kbcli version` to check the version of kbcli and ensure that it is successfully installed. :::note If a timeout exception occurs during installation, please check your network settings and retry. ::: </TabItem> </Tabs> `kbcli` supports command line auto-completion. ```bash kbcli completion SHELL-TYPE -h ``` For example, enable kbcli auto-completion for zsh. *Steps:* Check the user guide. ```bash kbcli completion zsh -h ``` Enable the completion function of your terminal first. ```bash echo "autoload -U compinit; compinit" >> ~/.zshrc ``` Enable the `kbcli` automatic completion function. ```bash echo "source <(kbcli completion zsh); compdef _kbcli kbcli" >> ~/.zshrc ```