{"record":{"id":"7c8647b8a78477ec","repo":"jdx/mise","slug":"failed-to-provision-ruby-for-building-from-source","errorCode":null,"errorMessage":"failed to provision ruby for building from source (try `mise install ruby`)","messagePattern":"failed to provision ruby for building from source \\(try `mise install ruby`\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/source.rs","lineNumber":211,"sourceCode":"            // only ruby — never drag the rest of the config's toolset in\n            missing_args_only: true,\n            reason: \"brew source build\".to_string(),\n            ..Default::default()\n        },\n    )\n    .await?;\n    for (backend, tv) in ts.list_current_versions() {\n        if tv.ba().short != \"ruby\" {\n            continue;\n        }\n        for bin_dir in backend.list_bin_paths(&config, &tv).await? {\n            let ruby = bin_dir.join(\"ruby\");\n            if ruby.is_file() {\n                return Ok(ruby);\n            }\n        }\n    }\n    bail!(\"failed to provision ruby for building from source (try `mise install ruby`)\");\n}\n\n/// Download the formula's .rb from homebrew/core, pinned to the commit the\n/// API metadata was generated from and verified against its sha256.\nasync fn fetch_formula_rb(rf: &ResolvedFormula, pr: &dyn SingleReport) -> Result<PathBuf> {\n    let formula = &rf.formula;\n    // all guaranteed present by check_buildable\n    let rb_path = formula.ruby_source_path.as_ref().unwrap();\n    let sha256 = formula\n        .ruby_source_checksum\n        .as_ref()\n        .and_then(|c| c.sha256.as_deref())\n        .unwrap();\n    let commit = formula.tap_git_head.as_deref().unwrap();\n    let cache_dir = crate::dirs::CACHE.join(\"system-brew\").join(\"formula\");\n    let dest = cache_dir.join(format!(\"{}-{}.rb\", formula.name, &sha256[..12]));\n    if dest.exists() && crate::hash::ensure_checksum(&dest, sha256, None, \"sha256\").is_ok() {\n        return Ok(dest);","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/packages/brew/source.rs#L193-L229","documentation":"Building a formula from source requires executing the Ruby formula file, so mise scans the current toolset for a ruby binary it installed. If no mise-managed ruby is present, provisioning fails and the build stops with an actionable hint. System rubies installed outside mise are not considered.","triggerScenarios":"provision_ruby iterates ts.list_current_versions(), finds no ruby backend/version, and no toolset bin path contains a `ruby` binary — i.e. a source build was attempted without `mise install ruby`.","commonSituations":"Fresh machines or minimal containers where ruby was never added to the mise toolset; users whose only ruby is the system/OS package; source builds triggered on platforms without bottles.","solutions":["Run `mise install ruby` (or add ruby to mise.toml tools), then retry the package install","Add ruby to your bootstrap config so it is always present before any source build","Avoid the source-build path entirely by ensuring a bottle exists for your platform"],"exampleFix":"# before\n$ mise bootstrap packages apply   # -> failed to provision ruby for building from source\n\n# after\n$ mise install ruby\n$ mise bootstrap packages apply","handlingStrategy":"validation","validationCode":"# ensure a mise-managed ruby exists before any source build\nmise ls current ruby 2>/dev/null | grep -q . || mise install ruby","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add ruby to your mise tools/bootstrap config on machines that may build formulae from source","Remember mise only finds ruby it installed itself — system rubies are not used","Bottle-less platforms hit the source path most; pre-install ruby there"],"tags":["brew","source-build","ruby","toolchain"],"backgroundTag":"missing-build-toolchain","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}