Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(cli): avoid AppleScript permission error in `composio login`
Stop using `apps.browser` from the `open` package, which triggers AppleScript-based default browser detection and fails on macOS when the terminal lacks Apple Events permissions (error -1743). Plain `open(url)` lets the OS handle browser selection natively. Also gracefully catch browser-open failures and print a tip suggesting `composio login --no-browser` instead of crashing.
jkomyno committed
Feb 19, 2026 at 02:58 UTC
a4470b33572fd63154af59355d94c64379195815
1 file changed
+16
-9
ts/packages/cli/src/commands/login.cmd.ts
+16
-9
@@ -1,6 +1,6 @@
1
import { Command, Options } from '@effect/cli';
2
import { Effect, Schedule } from 'effect';
3
-import open, { apps } from 'open';
3
+import open from 'open';
4
import { ComposioSessionRepository } from 'src/services/composio-clients';
5
import { ComposioUserContext } from 'src/services/user-context';
6
import { TerminalUI } from 'src/services/terminal-ui';
@@ -54,14 +54,21 @@ export const loginCmd = Command.make('login', { noBrowser }, ({ noBrowser }) =>
54
yield* ui.output(url);
55
56
if (!noBrowser) {
57
- // Open the given `url` in the default browser
58
- yield* Effect.tryPromise(() =>
59
- open(url, {
60
- app: {
61
- name: apps.browser,
62
- },
63
- wait: false,
64
- })
57
+ // Open the given `url` in the default browser.
58
+ // Do NOT use `apps.browser` — it triggers AppleScript-based default browser
59
+ // detection (`bundle-name` → Finder + System Events), which fails on macOS
60
+ // when the terminal lacks Apple Events permissions (error -1743).
61
+ // Calling `open(url)` without an app lets the OS handle browser selection natively.
62
+ yield* Effect.tryPromise(() => open(url, { wait: false })).pipe(
63
+ Effect.catchAll(error =>
64
+ Effect.gen(function* () {
65
+ yield* Effect.logDebug('Failed to open browser:', error);
66
+ yield* ui.log.warn('Could not open the browser automatically.');
67
+ yield* ui.log.info(
68
+ `Tip: try using \`composio login --no-browser\` and open the URL manually.`
69
+ );
70
+ })
71
+ )
72
);
73
}
74