BigPizzaV3/CodexPlusPlus · error
macOS bundle binary is not a regular file
Error message
macOS bundle binary is not a regular file: {} What it means
Thrown by validate_binary_source in crates/codex-plus-core/src/install/macos.rs when the macOS app-bundle's embedded Codex++ binary path exists but its filesystem metadata says it is not a regular file (e.g. a directory, symlink-to-directory, fifo, or device). The install step validates the source binary before writing it into the bundle so a corrupt bundle is never produced.
Solutions
- Check the configured binary path with `ls -la` and confirm it is a regular file, not a directory or special file
- Rebuild or re-download the Codex++ binary so a real executable exists at the expected path
- Fix the install options/path config so it points to the actual binary inside Contents/MacOS
- Remove stale non-file artifacts (symlinks, fifos, dirs) at that path before re-running install
Example fix
// before: passing a directory as the binary source
install(InstallOptions { binary: PathBuf::from("/app/CodexPlusPlus.app/Contents/MacOS"), .. })
// after: point at the regular-file executable
install(InstallOptions { binary: PathBuf::from("/app/CodexPlusPlus.app/Contents/MacOS/codex-plus"), .. }) Defensive patterns
Strategy: validation
Validate before calling
let meta = std::fs::metadata(&path).map_err(|e| format!("binary missing: {e}"))?;
if !meta.is_file() { return Err(format!("{} is not a regular file", path.display())); } Type guard
fn is_regular_file(p: &Path) -> bool {
std::fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)
} Prevention
- Always run `file <path>` on the binary source before packaging
- Point install options at the executable file, never its parent directory
- Add a pre-install script that fails fast on non-regular-file binaries
- Clean stale symlinks/fifos from build output dirs
When it happens
Trigger: Calling write_bundle (via install_entrypoints/install_app_bundles on macOS) when the source binary path passes fs::metadata().exists() but !metadata.is_file() — e.g. the path points at a directory or special file instead of the compiled binary.
Common situations: A build/packaging script left a directory where the binary should be; a misconfigured settings path points to the bundle's Contents/MacOS folder itself; a leftover named pipe or symlink from a previous partial install; stale config pointing at a resources dir rather than the executable.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- macOS bundle binary is unavailable at
- macOS bundle binary is unexpectedly small
- macOS bundle binary points to a shell script
- 当前平台暂不支持安装 Codex++ 入口
- Codex CLI 路径指向的是目录而不是可执行文件:
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/b6f9759c15a7bc37.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/install/macos.rs:147
let executable = macos.join(executable_name_from_plist(&bundle.info_plist));
fs::write(&executable, &bundle.launch_script)?;
let mut permissions = fs::metadata(&executable)?.permissions();
permissions.set_mode(0o755);
fs::set_permissions(executable, permissions)?;
copy_icon(&resources)?;
Ok(())
}
#[cfg(target_os = "macos")]
fn validate_binary_source(path: &Path) -> anyhow::Result<()> {
let metadata = fs::metadata(path).map_err(|error| {
anyhow::anyhow!(
"macOS bundle binary is unavailable at {}: {error}",
path.display()
)
})?;
if !metadata.is_file() {
anyhow::bail!(
"macOS bundle binary is not a regular file: {}",
path.display()
);
}
if metadata.len() < 1024 {
anyhow::bail!(
"macOS bundle binary is unexpectedly small: {}",
path.display()
);
}
let mut header = [0_u8; 2];
let mut file = fs::File::open(path)?;
use std::io::Read;
let read = file.read(&mut header)?;
if read == header.len() && header == *b"#!" {
anyhow::bail!(
"macOS bundle binary points to a shell script: {}",
path.display()View on GitHub (pinned to b1ed92e5e4)