jdx/mise · error

brew-cask is not available

Error message

brew-cask is not available: {}

What it means

mise's `mise system prune brew-cask` requires the Homebrew cask manager. Before pruning, it constructs a BrewCaskManager and checks `is_available()`; if Homebrew (or its cask support) cannot be located or initialized, the unavailable reason is surfaced via this bail to stop the prune before any packages are touched.

Solutions

  1. Install Homebrew so `brew` is on PATH, then re-run the prune command
  2. Verify discovery with `brew --version` in the same shell where mise runs; fix PATH or HOMEBREW_PREFIX if it fails
  3. Use `mise system prune brew` (formulae) instead if you only need formula pruning and casks are irrelevant
  4. Run the command on macOS/Homebrew-supported platforms, since cask management is Homebrew-dependent

Example fix

// before (brew missing)
mise system prune brew-cask
# error: brew-cask is not available: ...
// after
brew --version || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
mise system prune brew-cask
Defensive patterns

Strategy: fallback

Validate before calling

command -v brew >/dev/null 2>&1 && mise system prune brew-cask || echo 'homebrew unavailable'

Try / catch

if ! mise system prune brew-cask; then echo 'skipping cask prune: homebrew unavailable'; fi

Prevention

When it happens

Trigger: Running `mise system prune brew-cask` (or the equivalent manager selection routed to run_brew_cask) on a machine where the `brew` binary is not installed, not on PATH, or the Homebrew prefix cannot be resolved — `BrewCaskManager::new().is_available()` returns false and `unavailable_reason()` supplies the detail interpolated into the message.

Common situations: Running brew-cask prune on Linux without Homebrew installed; Homebrew installed in a non-default prefix not discovered by mise; PATH stripped of brew in CI or non-interactive shells; invoking the command on a machine where only formulae (no casks) are managed.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/e49295746d39503c. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/system/prune.rs:180

        if !self.yes && !Settings::get().yes && console::user_attended_stderr() {
            let msg = format!("brew: prune {}?", remove.join(", "));
            if !prompt::confirm(msg)?.is_yes() {
                info!("brew: skipped");
                return Ok(());
            }
        }
        let removed = plan.remove.len();
        brew::apply_prune_plan(&plan, false)?;
        info!("brew: pruned {removed} formulae");
        Ok(())
    }

    #[cfg(unix)]
    async fn run_brew_cask(self) -> Result<()> {
        debug_assert_eq!(self.manager, "brew-cask");
        let manager = brew::BrewCaskManager::new();
        if !manager.is_available() {
            bail!(
                "brew-cask is not available: {}",
                manager.unavailable_reason()
            );
        }
        let config = Config::get().await?;
        let configured = system::packages_from_config_and_tracked_config_files(&config)
            .await?
            .into_iter()
            .find(|mp| mp.manager.name() == "brew-cask")
            .map(|mp| mp.requests)
            .unwrap_or_default();
        let plan = brew::cask_prune_plan(&configured).await?;
        for skipped in &plan.skipped {
            warn!("brew-cask:{}: skipped: {}", skipped.token, skipped.reason);
        }
        if plan.is_empty() {
            info!("brew-cask: nothing to prune");
            return Ok(());

View on GitHub (pinned to 533346cc37)