{"record":{"id":"e8a6cedc4b22139a","repo":"jdx/mise","slug":"mas-cannot-install-a-pinned-version-p","errorCode":null,"errorMessage":"mas cannot install a pinned version ('{p}')","messagePattern":"mas cannot install a pinned version \\('(.+?)'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/mas.rs","lineNumber":257,"sourceCode":"        }\n    }\n\n    async fn unavailable_reason_async(&self) -> Option<String> {\n        self.bin().await.err().map(|err| format!(\"{err:#}\"))\n    }\n\n    fn supports_version_pins(&self) -> bool {\n        false\n    }\n\n    async fn installed(&self, pkgs: &[PackageRequest]) -> Result<Vec<PackageStatus>> {\n        let apps = mas_list(self.bin().await?).await?;\n        Ok(statuses_from_apps(&apps, pkgs))\n    }\n\n    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {\n        if let Some(p) = pkgs.iter().find(|p| p.version.is_some()) {\n            bail!(\"mas cannot install a pinned version ('{p}')\");\n        }\n        if let Some(p) = pkgs.iter().find(|p| !is_adam_id(&p.name)) {\n            bail!(\"mas install requires a numeric ADAM ID ('{p}'); use `mas search` to find it\");\n        }\n        let mut args = vec![\"install\".to_string()];\n        args.extend(pkgs.iter().map(|p| p.name.clone()));\n        if opts.dry_run {\n            miseprintln!(\"mas {}\", args.join(\" \"));\n            return Ok(());\n        }\n        debug!(\"$ mas {}\", args.join(\" \"));\n        let output = tokio::process::Command::new(self.bin().await?)\n            .args(&args)\n            .stdin(Stdio::null())\n            .output()\n            .await?;\n        if !output.status.success() {\n            let stderr = String::from_utf8_lossy(&output.stderr);","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/mas.rs#L239-L275","documentation":"The mas backend's install() rejects any PackageRequest with a pinned version. The Mac App Store only installs the current latest release of an app; there is no mechanism to install a specific older version via `mas install`, so the backend fails fast instead of ignoring the pin.","triggerScenarios":"Calling install() with at least one request whose `version` is Some — the first such request is named in the message.","commonSituations":"A lockfile or config pins versions for all tools uniformly and those requests are forwarded to the mas backend; reproducing an older app build by pinning its version.","solutions":["Drop the version field from mas PackageRequests so they install the latest App Store release.","Install the specific older version manually (e.g. via App Store purchase history or a downloaded IPA); mas cannot do this.","Filter pinned requests out before calling the mas backend and handle them with a different backend."],"exampleFix":"// before\nlet pkgs = vec![PackageRequest { name: \"497799835\".into(), version: Some(\"3.2\".into()) }];\nbackend.install(&pkgs, &opts).await?;\n// after\nlet pkgs = vec![PackageRequest { name: \"497799835\".into(), version: None }];\nbackend.install(&pkgs, &opts).await?;","handlingStrategy":"validation","validationCode":"if pkgs.iter().any(|p| p.version.is_some()) { /* strip or split pins before mas install */ }","typeGuard":"fn is_unpinned(p: &PackageRequest) -> bool { p.version.is_none() }","tryCatchPattern":null,"preventionTips":["Never set version on mas package requests; the App Store only serves latest.","In per-backend request builders, force version: None for mas.","Handle version-pinned app needs outside mas (manual install)."],"tags":["mas","version-pinning","install","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}