{"record":{"id":"e4c2a4f5f817c532","repo":"jdx/mise","slug":"only-available-on-macos","errorCode":null,"errorMessage":"only available on macos","messagePattern":"only available on macos","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/mas.rs","lineNumber":29,"sourceCode":"use crate::backend::configured_toolset_or_path_which;\nuse crate::config::Config;\nuse crate::result::Result;\n\n/// Mac App Store apps via the `mas` CLI.\npub(crate) struct MasManager {\n    bin: OnceCell<PathBuf>,\n}\n\nimpl MasManager {\n    pub(crate) fn new() -> Self {\n        Self {\n            bin: OnceCell::new(),\n        }\n    }\n\n    async fn bin(&self) -> Result<&PathBuf> {\n        if !cfg!(target_os = \"macos\") {\n            bail!(\"only available on macos\");\n        }\n        self.bin\n            .get_or_try_init(|| async {\n                let config = Config::get().await?;\n                configured_toolset_or_path_which(&config, [\"mas\".to_string()], \"mas\")\n                    .await?\n                    .ok_or_else(|| eyre!(\"mas not found\"))\n            })\n            .await\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq)]\nstruct InstalledApp {\n    adam_id: Option<String>,\n    bundle_id: Option<String>,\n    version: String,\n}","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/mas.rs#L11-L47","documentation":"The mas (Mac App Store) backend only works on macOS because the `mas` CLI itself is macOS-only. `bin()` is the gatekeeper every mas operation passes through to locate the binary, so any mas backend call on Linux or Windows fails immediately with this message before any subprocess is spawned.","triggerScenarios":"Any operation on the mas package backend (installed/list, install, upgrade) invoked on a non-macOS target, since each path first resolves the mas binary via `bin()` which checks `cfg!(target_os = \"macos\")`.","commonSituations":"Shared mise config or toolset files listing mas-managed packages synced to a Linux CI machine or Windows workstation; running a cross-platform dotfiles bootstrap that includes Mac App Store apps.","solutions":["Run the command on a macOS machine, or restrict mas package entries to macOS-specific config files that are only loaded there.","Use platform-conditional configuration so mas packages are only requested when `cfg!(target_os = \"macos\")`-equivalent (uname == Darwin) holds.","Replace mas-managed packages with a cross-platform source if you need the same setup on non-Apple machines."],"exampleFix":"// before\nbackend.install(&mas_pkgs, &opts).await?; // panics into bail on Linux\n// after\nif cfg!(target_os = \"macos\") {\n    backend.install(&mas_pkgs, &opts).await?;\n}","handlingStrategy":"validation","validationCode":"if !cfg!(target_os = \"macos\") { return; } // skip mas operations on other platforms\nbackend.installed(&pkgs, &opts).await?;","typeGuard":"fn mas_supported() -> bool { cfg!(target_os = \"macos\") }","tryCatchPattern":null,"preventionTips":["Gate mas package lists behind macOS-only config files.","Check target OS before registering the mas backend in cross-platform tooling.","Never sync mas entries into shared/global configs loaded on Linux or Windows."],"tags":["macos","mas","platform","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}