{"record":{"id":"b27cb78632e55f24","repo":"hashicorp/vagrant","slug":"failed-to-determine-macos-version-version-stri","errorCode":null,"errorMessage":"Failed to determine macOS version.\n\n  Version string: %{version}\n  Error information: %{error}","messagePattern":"Failed to determine macOS version\\.\n\n  Version string: %(.+?)\n  Error information: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::DarwinVersionFailed","httpStatus":null,"severity":"error","filePath":"plugins/hosts/darwin/cap/version.rb","lineNumber":11,"sourceCode":"# Copyright IBM Corp. 2010, 2025\n# SPDX-License-Identifier: BUSL-1.1\n\nmodule VagrantPlugins\n  module HostDarwin\n    module Cap\n      class Version\n        def self.version(env)\n          r = Vagrant::Util::Subprocess.execute(\"sw_vers\", \"-productVersion\")\n          if r.exit_code != 0\n            raise Vagrant::Errors::DarwinVersionFailed,\n              version: r.stdout,\n              error: r.stderr\n          end\n          begin\n            Gem::Version.new(r.stdout)\n          rescue => err\n            raise Vagrant::Errors::DarwinVersionFailed,\n              version: r.stdout,\n              error: err.message\n          end\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/hosts/darwin/cap/version.rb#L1-L27","documentation":"Vagrant::Errors::DarwinVersionFailed raised at plugins/hosts/darwin/cap/version.rb:11. The Darwin host capability resolves the macOS version by running `sw_vers -productVersion` through Vagrant::Util::Subprocess; if the command exits non-zero, Vagrant raises with %{version} = r.stdout and %{error} = r.stderr. This blocks every code path that dispatches on the host macOS version (SMB behavior, capability selection).","triggerScenarios":"Any Vagrant operation needing the host macOS version executes `sw_vers -productVersion` in an environment where it fails: PATH scrubbed of /usr/bin (IDEs, wrappers, launchd contexts), the binary damaged, or a sandbox denying the spawn.","commonSituations":"Running Vagrant through an IDE/plugin with a minimal PATH; MDM/SIP restrictions; a repaired-but-broken OS install; scripts that alias or shadow sw_vers.","solutions":["Run `/usr/bin/sw_vers -productVersion` in the same shell you launch Vagrant from and confirm it prints e.g. `14.5`","Fix PATH so /usr/bin is present (`echo $PATH`), or launch vagrant from a normal Terminal session","Remove any shell alias/function/shim that intercepts sw_vers","If the binary itself is broken, repair macOS; otherwise update Vagrant"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"raise \"sw_vers unavailable on this host\" unless system(\"/usr/bin/sw_vers -productVersion >/dev/null 2>&1\")\n# or from Ruby inside a plugin:\n# Vagrant::Util::Subprocess.execute(\"/usr/bin/sw_vers\", \"-productVersion\").exit_code.zero?","typeGuard":null,"tryCatchPattern":"begin\n  capability.call(:version, env)\nrescue Vagrant::Errors::DarwinVersionFailed => e\n  puts \"sw_vers failed: #{e.data[:error]}\"\n  raise\nend","preventionTips":["Launch vagrant from a normal Terminal session with /usr/bin on PATH","In wrappers/IDE/CI, preserve a standard PATH instead of scrubbing it","Don't alias or shim sw_vers"],"tags":["macos","version-detection","sw-vers","subprocess"],"backgroundTag":"os-version-detection-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}