Sub topic 2
Installing the Databricks CLI
This chapter assumes you can use a shell and edit your PATH, and that you have access to a Databricks workspace. By the end you will have the current Databricks CLI installed and verified, and you will know how to spot the old CLI that can shadow it.
Two CLIs, one name
Databricks has shipped two command-line tools, and both are called databricks.
| Version | Language | Installed with | Status |
|---|---|---|---|
| 0.18.x and earlier | Python | `pip install databricks-cli` | Legacy |
| 0.205 and later | Go (single binary) | Homebrew, WinGet, install script, or a release download | Current |
The current CLI is a standalone binary. It needs no Python environment. It also supports Databricks Asset Bundles, which later chapters use. Install the current one.
Choose an install method
macOS with Homebrew
brew tap databricks/tap
brew install databricksWindows with WinGet
winget install Databricks.DatabricksCLIOpen a new terminal afterwards so the updated PATH is loaded.
Linux, macOS, or CI with the install script
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | shThe script downloads the binary for your platform and places it in a directory on your PATH. On some systems it needs sudo to write to /usr/local/bin.
Verify the installation
databricks --version
which databricksThe first command should print a version of 0.205 or higher. The second shows which binary your shell will run. Both checks matter because of the main installation error.
Common errors
- The version prints 0.18 or lower. The legacy Python CLI is earlier on your
PATH. Runwhich -a databricksto list every match. Remove the old one withpip uninstall databricks-cli, then open a new shell. command not foundafter installing. The install directory is not on yourPATH, or your shell has not reloaded. Open a new terminal, or add the directory to your shell profile.databricks bundleis not a known command. This also points to the legacy CLI.- The install script fails with a permission error. Rerun it with
sudo, or download the release archive and put the binary in a directory you own, such as~/bin.
Keeping the CLI current
Upgrade with the same tool you installed with.
brew upgrade databricksOn Windows, use winget upgrade Databricks.DatabricksCLI. If you installed with the script, run the script again. Pin the version in CI so that a new release cannot change your pipeline's behavior unexpectedly.
The CLI has no credentials yet. The next chapter covers logging in with OAuth or a personal access token.
Exercise
You installed the current Databricks CLI, but databricks --version prints 0.18.0, and databricks bundle is an unknown command. What is the likely cause, and how do you confirm and fix it?
Show answer
The legacy Python CLI appears earlier on your PATH and shadows the new binary. Confirm with which -a databricks, which lists every match in PATH order. Fix it by running pip uninstall databricks-cli, or by moving the new binary's directory earlier in PATH. Then open a new shell and check that databricks --version prints 0.205 or higher.