matryer/xbar · error
run in terminal script failed: %s
Error message
run in terminal script failed: %s
What it means
On macOS, runInTerminal executes a helper shell script that opens a terminal running the plugin interactively. The command's stderr is captured, and run errors are intentionally ignored/logged; however if the script's process exit code is non-zero, this error is returned containing the script's stderr output.
Source
Thrown at pkg/plugins/plugin_darwin.go:49
}{
Command: commandLine,
Vars: fmt.Sprintf("%q", variablesEnvString(vars)),
Params: paramsStr,
})
if err != nil {
return err
}
appleScript := renderedScript.String()
log.Println(p.Command, "RunInTerminal", appleScript)
cmd := exec.Command("osascript", "-s", "h", "-e", appleScript)
var stderr bytes.Buffer
cmd.Stderr = &stderr
err = cmd.Run()
if err != nil {
p.Debugf("(ignoring) RunInTerminal failed: %s", err)
}
if cmd.ProcessState != nil && cmd.ProcessState.ExitCode() != 0 {
return errors.Errorf("run in terminal script failed: %s", stderr.String())
}
return nil
}
View on GitHub (pinned to d624239058)
Solutions
- Read the stderr text embedded in the error — it names why the script failed
- Verify a GUI terminal (Terminal.app) is available and you're in a graphical session
- Grant Automation permissions so the helper can control/open the terminal app
- Test the plugin command directly in a terminal to rule out command-specific failures
Example fix
// before // running RunInTerminal over SSH (no GUI) -> script exits non-zero // after // run from a logged-in GUI session, or invoke the plugin command directly
Defensive patterns
Strategy: try-catch
Try / catch
if err := p.RunInTerminal(ctx); err != nil {
var termErr interface{ Error() string }
_ = termErr
log.Printf("RunInTerminal failed: %v", err) // stderr text is inside the message
// fall back to running the command non-interactively
} Prevention
- Only call RunInTerminal from a GUI session
- Verify Terminal.app opens manually on the target machine
- Grant Automation permissions for terminal launching
When it happens
Trigger: cmd.Run() completes but ProcessState.ExitCode() != 0 for the darwin terminal helper script — e.g. the terminal app can't be launched, the script can't find/open Terminal.app, or the inner command fails.
Common situations: No GUI session available (SSH, headless mac), terminal application missing or non-standard, security/permissions blocking app launch (Automation/TCC prompts denied).
Related errors
- run in terminal script failed: %s
- run in terminal script failed: %s
- malformed xbar.var format (default not in select options)
- unknown xbar.var type: %s
- no plugin files
AI-assisted analysis of matryer/xbar@d624239058 (2026-09-02).
Data as JSON: /api/errors/328de17011327556.
Report an issue: GitHub.