gitbutlerapp/gitbutler · error

DefaultTerminalNotFound

DefaultTerminalNotFound

Error message

'{app_name}' was not found - `open -Ra {app_name}` failed.

What it means

On macOS, open_in_terminal verifies that the selected terminal app exists by running `open -Ra <AppName>` before launching it. When that probe exits non-zero, macOS reports the application is not installed/registered with LaunchServices, so ensure_app_installed raises DefaultTerminalNotFound with this message. It exists so users get a clear 'install the app' error instead of a vague launch failure.

Solutions

  1. Install the selected terminal application (e.g. via Homebrew: `brew install --cask iterm2`) or pick a different, installed terminal in Settings.
  2. If the app is installed but not registered, open it once manually or run `lsregister -f /Applications/<App>.app` so `open -Ra` can find it.
  3. Verify with `open -Ra <AppName>; echo $?` that macOS can see the app before re-triggering the action.
  4. Reset the default terminal setting in the app's Settings to a terminal that is installed.

Example fix

// before (Settings persisted a terminal that was uninstalled)
open_in_terminal("iterm2", path) // -> DefaultTerminalNotFound
// after
// reinstall or re-register:
// $ brew install --cask iterm2
open_in_terminal("iterm2", path) // succeeds
Defensive patterns

Strategy: validation

Validate before calling

import { invoke } from '@tauri-apps/api/core';
// before opening, verify the app is visible to macOS
const res = await invoke('run_command', { program: 'open', args: ['-Ra', 'iTerm'] });
if (res.code !== 0) throw new Error(`iTerm is not installed; pick another terminal in Settings`);

Try / catch

try {
  await openInTerminal('iterm2', path);
} catch (e) {
  if (String(e).includes('was not found')) {
    showToast('Terminal not installed. Install it or choose another in Settings.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling open_in_terminal (or the UI 'Open in terminal' action) with terminal_id like 'terminal', 'iterm2', 'warp', 'ghostty', 'hyper', 'alacritty-mac', or 'kitty' when the corresponding .app bundle is not installed or not visible to LaunchServices.

Common situations: User picks a terminal in GitButler Settings on a machine where that terminal was later uninstalled; app installed in a custom location not registered with LaunchServices; terminal only available via homebrew cask that was never linked as an .app; fresh macOS setup without iTerm2/Warp etc.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/2bed226d03b3eaeb. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-api/src/open/mod.rs:426

                .map_or("unknown".to_string(), |c| c.to_string());
            if stderr.is_empty() {
                bail!("{terminal_name} exited with non-zero status: {status_code}",);
            } else {
                bail!("Failed to open {terminal_name} ({status_code}): {stderr}");
            }
        }

        /// Check if a macOS application is installed using `open -Ra`.
        fn ensure_app_installed(app_name: &str) -> Result<()> {
            let status = Command::new("open")
                .arg("-Ra")
                .arg(app_name)
                .stdout(Stdio::null())
                .stderr(Stdio::null())
                .status()
                .context("Failed to run 'open -Ra' to check application availability")?;
            if !status.success() {
                return Err(anyhow::anyhow!(
                    "'{app_name}' was not found - `open -Ra {app_name}` failed."
                )
                .context(but_error::Code::DefaultTerminalNotFound));
            }
            Ok(())
        }

        let open_with_path = |app_name: &str, alt_app_name: Option<&str>| {
            ensure_app_installed(app_name)?;
            let mut cmd = Command::new("open");
            cmd.arg("-a").arg(app_name).arg(&path);
            run_terminal_command(cmd, alt_app_name.unwrap_or(app_name), &path)
        };

        match terminal_id.as_str() {
            // These terminals support `open -a <app> <path>` as folder handlers
            "terminal" => open_with_path("Terminal", None)?,
            "iterm2" => open_with_path("iTerm", Some("iTerm2"))?,

View on GitHub (pinned to 58e5313667)