jdx/mise · error · eyre::Report

brew import is not supported on windows

Error message

brew import is not supported on windows

What it means

The brew import implementation only exists behind #[cfg(unix)]. On Windows, run_brew is compiled as a stub that immediately fails with this message — importing Homebrew formulae is simply not supported there, regardless of whether brew-like tooling is installed.

Source

Thrown at src/cli/system/import.rs:178

            cf.update_bootstrap_package_with_fallback(
                &key,
                "latest",
                configured_packages.get(&key),
            )?;
        }
        cf.save()?;
        info!(
            "{}: imported {} brew formulae",
            display_path(&path),
            formulae.len()
        );
        Ok(())
    }

    #[cfg(not(unix))]
    async fn run_brew(self) -> Result<()> {
        let _ = self.manager;
        bail!("brew import is not supported on windows")
    }
}

#[cfg(unix)]
fn imported_package_value(
    target: Option<&PackageTomlConfig>,
    configured: Option<&PackageTomlConfig>,
) -> Value {
    let options = match target {
        Some(PackageTomlConfig::Options(options)) => Some(options),
        Some(PackageTomlConfig::Version(_)) => None,
        None => match configured {
            Some(PackageTomlConfig::Options(options)) if !options.os.is_empty() => Some(options),
            _ => None,
        },
    };
    let Some(options) = options else {
        return Value::from("latest");

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Skip the brew import on Windows (guard the step: `if [ "$(uname)" != "Linux" ]` / `os: [ubuntu, macos]` in CI, or `if runner.os != 'Windows'`)
  2. On Windows, manage equivalent packages with a supported manager (e.g. winget) and configure its [bootstrap.packages] entries
  3. Keep brew-based bootstrap config in Unix-only mise config files so Windows never loads those entries

Example fix

# before (runs on all OSes)
mise system import brew   # fails on Windows

# after (GitHub Actions)
- if: runner.os != 'Windows'
  run: mise system import brew
Defensive patterns

Strategy: validation

Validate before calling

# bash: gate brew imports to Unix hosts
case "$(uname -s)" in Linux|Darwin) mise system import brew ;; *) echo "skip: brew import unsupported on $(uname -s)" ;; esac

Prevention

When it happens

Trigger: Running `mise system import brew` (or any import path that routes to run_brew) on a Windows host — the cfg(not(unix)) variant always bails.

Common situations: Cross-platform dotfiles/bootstrap scripts running the same mise commands on Windows; CI matrices that include windows-latest; users assuming mise abstracts brew across OSes.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/62f4547ebda93894. Report an issue: GitHub.