You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenCode background service hangs Terminal.app #51329
After running opencode, the service that is started prevents Terminal.app quitting cleanly. This is a problem on recent macOS which will report to you that the service is a leaked background process. It may well be deliberate and intentional that the service is spawned in the background, but it's not done in a way that the OS thinks is kosher.
Plugins
No response
OpenCode version
v2
Steps to reproduce
Launch Terminal.app
Run opencode e.g. opencode run "say hi"
Exit Terminal.app
Observe that the OS reports a background process and leaves Terminal.app in the Dock.
Thanks for the detailed report and the video! In v2, opencode starts a shared background service on purpose, and it keeps running after the command ends. What you're seeing is how macOS reacts to that service: Terminal.app can't quit cleanly and macOS reports a leaked background process. That only happens on macOS with Terminal.app, and our automated sandbox runs Linux, so it couldn't reproduce this. A maintainer with a Mac will need to look at it.
In the meantime, you can try turning off the background service (available since v2.1.4):
opencode service set disabled true
Each CLI call then runs its own private server and doesn't leave a service behind. To go back, run opencode service unset disabled. It would help if you could say whether Terminal.app quits cleanly with this setting, and which exact version opencode --version prints.
Related: #50633, where the Desktop app's background service keeps running after the app closes. A commenter there sees "Running in Background" on macOS 27.
Activity
[-]OpenCode background service hangs Terminal.ap[/-][+]OpenCode background service hangs Terminal.app[/+]github-actions commentedon Sep 25, 2026
This issue might be related to existing reports about background-service lifecycle and process cleanup. Please check:
opencode-cliservice remains running after the app closes; the report requests clean shutdown (Windows).opencodejr commentedon Oct 28, 2026
Thanks for the detailed report and the video! In v2,
opencodestarts a shared background service on purpose, and it keeps running after the command ends. What you're seeing is how macOS reacts to that service: Terminal.app can't quit cleanly and macOS reports a leaked background process. That only happens on macOS with Terminal.app, and our automated sandbox runs Linux, so it couldn't reproduce this. A maintainer with a Mac will need to look at it.In the meantime, you can try turning off the background service (available since v2.1.4):
Each CLI call then runs its own private server and doesn't leave a service behind. To go back, run
opencode service unset disabled. It would help if you could say whether Terminal.app quits cleanly with this setting, and which exact versionopencode --versionprints.Related: #50633, where the Desktop app's background service keeps running after the app closes. A commenter there sees "Running in Background" on macOS 27.