{"record":{"id":"629f8219c9cbdc90","repo":"jdx/mise","slug":"brew-cask-homebrew-owns-this-cask-remove-it-w","errorCode":null,"errorMessage":"brew-cask:{}: Homebrew owns this cask; remove it with Homebrew before installing it with mise","messagePattern":"brew-cask:(.+?): Homebrew owns this cask; remove it with Homebrew before installing it with mise","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":384,"sourceCode":"    }\n\n    async fn install_one_with_ancestors(\n        &self,\n        req: &PackageRequest,\n        opts: &InstallOpts,\n        pr: Option<&dyn SingleReport>,\n        ancestors: &BTreeSet<String>,\n    ) -> Result<String> {\n        let cask = fetch_cask(req).await?;\n        if ancestors.contains(&cask.token) {\n            bail!(\"brew-cask:{}: dependency cycle detected\", cask.token);\n        }\n        let mut ancestors = ancestors.clone();\n        ancestors.insert(cask.token.clone());\n        let artifacts = cask_artifacts(&cask)?;\n        validate_platform_support(&cask, &artifacts)?;\n        if homebrew_metadata_present(&cask.token) {\n            bail!(\n                \"brew-cask:{}: Homebrew owns this cask; remove it with Homebrew before installing it with mise\",\n                cask.token\n            );\n        }\n        if installed_cask_version(&cask, &artifacts)?.as_deref() == Some(cask.version.as_str()) {\n            info!(\"brew-cask:{}: already installed\", cask.token);\n            return Ok(cask.version);\n        }\n        for conflict in &cask.conflicts_with.cask {\n            if !installed_versions(conflict).is_empty() {\n                bail!(\n                    \"brew-cask:{}: conflicts with installed cask {}\",\n                    cask.token,\n                    conflict\n                );\n            }\n        }\n        if !cask.depends_on.formula.is_empty() {","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/packages/brew/cask.rs#L366-L402","documentation":"Before installing a cask, mise checks whether the Caskroom token directory contains Homebrew's `.metadata` marker (homebrew_metadata_present). If it exists, the cask was installed by Homebrew itself; mise refuses to take over an install it does not own, because overwriting would corrupt brew's receipts and break `brew upgrade`/`uninstall`.","triggerScenarios":"Running mise install/bootstrap for a cask (e.g. brew-cask:visual-studio-code) that was previously installed with `brew install --cask <token>`, so <Caskroom>/<token>/.metadata exists.","commonSituations":"Migrating a machine from brew to mise-managed bootstrap; shared machines where another user installed via brew; CI images that pre-install casks with brew and then run mise bootstrap.","solutions":["Uninstall the brew copy first: `brew uninstall --cask <token>`, then re-run the mise command","Or keep managing that cask with brew and remove it from mise's bootstrap/tools config"],"exampleFix":"# before\n$ mise install brew-cask:google-chrome\nerror: brew-cask:google-chrome: Homebrew owns this cask; remove it with Homebrew before installing it with mise\n\n# after\n$ brew uninstall --cask google-chrome\n$ mise install brew-cask:google-chrome","handlingStrategy":"validation","validationCode":"// Rust callers using mise internals can pre-check:\nfn homebrew_owns(token: &str) -> bool {\n    std::path::Path::new(&caskroom(token)).join(\".metadata\").symlink_metadata().is_ok()\n}\n// Shell users: ls \"$(brew --prefix)/Caskroom/<token>/.metadata\" 2>/dev/null && echo brew-owned","typeGuard":null,"tryCatchPattern":"Catch the 'Homebrew owns this cask' bail, print `brew uninstall --cask <token>` as remediation, and continue with the remaining packages in the batch.","preventionTips":["Choose one manager per cask: brew or mise, never both","Before adopting mise bootstrap on a brew-managed machine, uninstall casks you plan to hand to mise","Check for .metadata in the Caskroom token dir when scripting installs"],"tags":["homebrew","cask","ownership","mise"],"backgroundTag":"package-ownership-conflict","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}