Sub topic 2
Installing the Databricks CLI
This chapter covers installing the Databricks CLI on your machine, checking that you have the right program, and keeping its version under control. Authentication comes in the next chapter.
Prerequisites
This chapter assumes you can do the following:
- Open a terminal and run commands in it (bash, zsh, PowerShell, or WSL).
- Understand what
PATHis and how to inspect it. - Use a package manager on your operating system, such as Homebrew or winget.
- Know what a Databricks workspace is. You don't need to be logged in yet.
Two programs share one name
Databricks has shipped two command-line tools, and both install an executable called databricks.
| Row | Legacy CLI | Current CLI |
|---|---|---|
| Written in | Python | Go |
| Installed with | `pip install databricks-cli` | Homebrew, winget, a shell script, or a release download |
| Version numbers | 0.18.x and lower | 0.205 and higher |
| Asset Bundles (`databricks bundle`) | Not supported | Supported |
| Status | Superseded | Actively developed |
This tutorial uses the current CLI. The later chapters on bundles need it, and the examples use its command syntax. The legacy CLI's databricks configure --token flow and its databricks jobs list output differ from what you will see here, so a leftover legacy install causes confusing errors.
The current CLI is a single, self-contained binary. It needs no Python, no virtual environment, and no runtime on the machine. That makes it easy to copy onto build servers and into containers.
Choosing an installation method
Pick the method that matches how you manage software on that machine.
Homebrew (macOS and Linux)
brew tap databricks/tap
brew install databricksHomebrew places the binary on your PATH and handles upgrades with brew upgrade databricks.
winget (Windows)
winget install Databricks.DatabricksCLIClose and reopen your terminal afterward so the new PATH entry is picked up. Windows users can also install inside WSL and follow the Linux steps. Chocolatey and the Windows release zip are alternatives. Use whichever your organization already supports.
Install script (Linux, macOS, WSL)
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | shThe script downloads the release binary for your operating system and CPU architecture and puts it in /usr/local/bin. If that directory is not writable by your user, the script needs sudo.
Release download
Every release is published on the databricks/cli GitHub releases page as a zip archive per platform. Unzip it and place the databricks binary in a directory on your PATH. This method gives you the most control. You choose the exact version, you can verify the archive, and you don't need a package manager. It is also the way to install on a locked-down host.
Verifying the installation
Run the version command:
databricks -vThe output looks like Databricks CLI v0.2xx.x, where the exact numbers depend on your install. Check two things in it: the program name and a version of 0.205 or higher. If you plan to follow the bundle chapters, aim for a recent release, because bundle features have been added steadily and some options require newer versions.
Then confirm the help system works:
databricks --helpYou should see command groups such as auth, bundle, clusters, jobs, and workspace. Every group and command takes --help, so databricks jobs --help lists the job subcommands and databricks jobs list --help shows that command's flags. This is the fastest way to check syntax without leaving the terminal.
Finding and removing conflicting installs
The most common installation problem is not a failed install. It is a successful install of the wrong program. Your shell runs the first databricks it finds on PATH, and an older copy can shadow the new one.
List every copy your shell can see:
which -a databricksOn PowerShell, use Get-Command databricks -All.
If you see more than one path, or the version output does not match what you just installed, work through these checks:
- Run
pip show databricks-cli. If it prints package details, the legacy CLI is installed. Remove it withpip uninstall databricks-cli. If you used a virtual environment orpipx, remove it from that environment. - Run
which -a databricksagain and confirm only the expected path remains. - Run
hash -rin bash or zsh to clear the shell's cached command locations. Otherwise the shell may keep trying the old path. - Open a new terminal and run
databricks -vagain.
The shell-script install and Homebrew can each put a binary in a different directory, for example /usr/local/bin and /opt/homebrew/bin. Pick one method per machine and stay with it. Otherwise upgrading with one tool leaves the other copy behind.
Updating and pinning versions
How you update depends on how you installed:
| Install method | Upgrade command |
|---|---|
| Homebrew | `brew upgrade databricks` |
| winget | `winget upgrade Databricks.DatabricksCLI` |
| Install script or release download | Rerun the script or replace the binary |
On a developer laptop, staying current is usually fine. For automation, pin the version. A CI job that installs "whatever is newest" can break overnight when a release changes a flag or default. Release downloads are tied to a version number, so you can record that number in your pipeline configuration and bump it deliberately after testing. Chapter 15 returns to this when it covers CI/CD.
Keep the CLI version in the same place as the rest of your project's configuration, such as a README or a .tool-versions style file. A teammate who installs a different version may see different behavior from the same bundle file.
Shell completion
The CLI can generate completion scripts, so pressing Tab completes command groups and flags. For zsh, for example, you can inspect the available options with:
databricks completion --helpThe help output lists the supported shells and shows how to load the script into yours. Completion is optional, but with the number of command groups the CLI has, it saves a lot of lookup time.
A quick checklist
Before moving on, confirm each of these from a fresh terminal:
databricks -v
which -a databricks
databricks --help- The version output starts with
Databricks CLIand shows 0.205 or higher. - Exactly one
databrickspath is listed. - The help output lists the
bundlecommand group.
If all three hold, the installation is complete. The CLI cannot talk to a workspace yet, because it doesn't know which workspace to call or who you are. The next chapter fixes that with OAuth login and personal access tokens.
Exercise
You installed the current Databricks CLI with Homebrew, but databricks -v still prints an old 0.18.x version, and databricks bundle --help says the command is unknown. What is the most likely cause, and what do you run to diagnose and fix it?
Show answer
An older, legacy Python-based CLI installed with pip is earlier on your PATH and shadows the new binary. Diagnose with which -a databricks (to see every copy) and pip show databricks-cli (to confirm the legacy package). Fix it with pip uninstall databricks-cli, then run hash -r or open a new terminal and check that databricks -v shows 0.205 or higher.
Exercise
Why should a CI pipeline pin the CLI to a specific version instead of installing the latest release on every run?
Show answer
A new release can change flags, defaults, or output, so an unpinned install can make a previously working pipeline fail without any change to your own code. Pinning makes runs reproducible, and you upgrade deliberately after testing the new version.