Skip to content

Commit d469948

Browse files
Fix macOS Databricks CLI auto-install to install the correct formula (#145)
Fix macOS Databricks CLI auto-install to use the databricks/tap formula On macOS the auto-installer ran `brew install databricks`, but the Databricks CLI is not in homebrew-core under that name — `databricks` resolves to an unrelated formula (the DataGrip cask), so users got the wrong tool installed. Install the fully-qualified `databricks/tap/databricks` formula instead, which resolves to the Databricks CLI and fails if the formula is missing, rather than silently falling back to the cask. Applies to both the install and upgrade paths. Co-authored-by: Isaac Co-authored-by: Rohit Agrawal <10210921+rohita5l@users.noreply.github.com>
1 parent 2e9d8e2 commit d469948

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/ucode/databricks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def _run_databricks_cli_installer(brew_subcommand: str = "install") -> None:
483483
timeout=240,
484484
)
485485
elif system == "Darwin" and shutil.which("brew"):
486-
run(["brew", brew_subcommand, "databricks"], timeout=240)
486+
run(["brew", brew_subcommand, "databricks/tap/databricks"], timeout=240)
487487
elif shutil.which("curl"):
488488
run(["sh", "-c", f"curl -fsSL {UNIX_DATABRICKS_INSTALL_URL} | sudo sh"], timeout=240)
489489
elif shutil.which("wget"):

tests/test_databricks.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
AI_GATEWAY_V2_DOCS_URL,
1414
_format_subprocess_result,
1515
_parse_databricks_cli_version,
16+
_run_databricks_cli_installer,
1617
_scrub_databrickscfg,
1718
_scrub_json,
1819
build_auth_shell_command,
@@ -804,6 +805,22 @@ def test_raises_when_version_unparseable(self, tmp_path, monkeypatch):
804805
ensure_databricks_cli_version()
805806

806807

808+
class TestRunDatabricksCliInstaller:
809+
@pytest.mark.parametrize("brew_subcommand", ["install", "upgrade"])
810+
def test_macos_uses_fully_qualified_tap_formula(self, monkeypatch, brew_subcommand):
811+
calls = []
812+
monkeypatch.setattr(db_mod.platform, "system", lambda: "Darwin")
813+
monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/opt/homebrew/bin/brew")
814+
monkeypatch.setattr(db_mod, "run", lambda cmd, **kw: calls.append(cmd))
815+
816+
_run_databricks_cli_installer(brew_subcommand=brew_subcommand)
817+
818+
# The fully-qualified formula forces Homebrew to the Databricks CLI in
819+
# databricks/tap and fails if absent, rather than falling back to the
820+
# unrelated `databricks` cask.
821+
assert calls == [["brew", brew_subcommand, "databricks/tap/databricks"]]
822+
823+
807824
class TestIsUsageTableAccessError:
808825
"""Pin which `ServerOperationError` strings trigger the friendly
809826
`system.ai_gateway.usage` permissions hint vs. fall through to the

0 commit comments

Comments
 (0)