jdx/mise · error
codesign failed for
Error message
codesign failed for {}: {} What it means
mise runs the `codesign` binary (macOS code-signing tool) on binaries whose prefix paths were relocated during a Homebrew bottle install. When codesign exits non-zero, mise bails with this message and appends codesign's stderr. It means the relocated binary could not be re-signed, leaving it potentially unlaunchable on macOS.
Solutions
- Re-run the install; transient codesign/trustd failures often succeed on retry
- Verify codesign exists and works: run `codesign --version` (install/repair Xcode Command Line Tools with `xcode-select --install` if missing)
- Check the failing binary with `file <path>`; if it is not a Mach-O binary, it should not require signing — report a mise bug if it does
- Reinstall the formula cleanly (`brew cleanup` then retry via mise) to replace a corrupted binary
Example fix
// before: failing inside mise mise install node@22 // after: ensure toolchain present, then retry xcode-select --install mise install node@22
Defensive patterns
Strategy: retry
Validate before calling
command -v codesign >/dev/null 2>&1 || xcode-select --install file "$(brew --prefix)/opt/<formula>/bin/<binary>" | grep -q Mach-O || echo 'not signable'
Try / catch
match mise install output containing 'codesign failed for' => rerun `mise install` once; if it persists, inspect the named file with `codesign -dvv` and `file` before filing a bug
Prevention
- Keep Xcode Command Line Tools installed and current on macOS
- Avoid interrupting installs mid-relocation
- Run `brew cleanup` after failed installs
- Watch for macOS updates that invalidate signing services
When it happens
Trigger: A bottle install relocated the prefix, then `codesign --force --sign - <file>` failed on that file — e.g. codesign not found, a corrupt/unreadable binary, a file codesign cannot sign (wrong Mach-O type), or keychain/signing-service failures.
Common situations: Partial or corrupted bottle extraction; signing a non-Mach-O file the formula listed; macOS security services (trustd) failing under heavy parallelism or in sandboxed/CI environments; PATH missing Xcode CLT so codesign is absent or broken.
Related errors
- app target is outside an allowed Applications directory
- ditto failed copying
- font target is outside the platform font directory
- `launchctl ` failed
- another process is installing the mise notification helper
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/75a51508cf1c8013.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/brew/relocate.rs:319
/// the kernel kills binaries whose signature doesn't match their contents.
pub(super) fn codesign(files: &[PathBuf]) -> Result<()> {
for file in files {
let res = crate::cmd::cmd(
"/usr/bin/codesign",
[
"--sign",
"-",
"--force",
"--preserve-metadata=entitlements,requirements,flags,runtime",
&file.to_string_lossy(),
],
)
.stderr_capture()
.stdout_capture()
.unchecked()
.run()?;
if !res.status.success() {
bail!(
"codesign failed for {}: {}",
file.display(),
String::from_utf8_lossy(&res.stderr).trim()
);
}
}
Ok(())
}
#[cfg(test)]
pub(super) mod tests {
use super::*;
use std::io::{Cursor, Read, Write};
use std::os::unix::fs::PermissionsExt;
/// fixed macOS-style replacements so tests behave the same on all hosts
pub(in super::super) fn test_replacements() -> Vec<Replacement> {
vec![View on GitHub (pinned to 533346cc37)