Skip to content

Bug: Browser Process Not Terminating on macOS with Chromium/Chrome #1

@imprvhub

Description

@imprvhub

Browser automation works correctly on macOS with Chromium and Chrome browsers, but the browser processes fail to terminate properly when attempting to close the browser window, requiring manual cleanup through Activity Monitor. This issue is specific to macOS and does not affect other Chromium-based browsers.

Environment

  • OS: macOS (all versions)
  • Browsers: chromium, chrome

Problem Details

When running browser automation with the MCP Browser Agent on macOS using either Chromium or Chrome:

  1. All automation features work as expected
  2. Browser operations complete successfully
  3. When attempting to close the browser window (e.g., right-clicking on the dock icon and selecting "Quit"), the browser window closes but the process remains active
  4. The browser process continues running in the background
  5. Manual termination is required via Activity Monitor or terminal commands (kill command)

Specific Behavior

  • Right-clicking the browser icon in the dock and selecting "Quit" closes the window but leaves the process running
  • Using Cmd+Q to quit the browser has the same effect - window closes, process remains
  • The only way to properly terminate the process is through Activity Monitor or terminal commands

Root Cause

This appears to be related to known issues in the Playwright repository regarding browser process cleanup on macOS. The issue has been tracked in multiple Playwright issues.

Workaround

Currently, users need to manually terminate the browser process after attempting to close the browser:

  1. Open Activity Monitor
  2. Search for the Chromium/Chrome process
  3. Force quit the process
  4. Or use terminal: ps aux | grep -i chrome and kill -9 [PID]

Proposed Solutions

While we await upstream fixes in Playwright, we're exploring several potential solutions:

  1. Force process termination: Implement a cleanup mechanism that forcefully kills the browser process on macOS after window closure
  2. Process monitoring: Add a background process monitor that detects window closure and cleans up orphaned browser processes
  3. Alternative browser contexts: Investigate using different browser context configurations that may handle cleanup better
  4. Signal handling: Implement custom signal handlers for macOS to ensure proper process termination on window close events

Status

This issue remains open as we evaluate different approaches to handle this platform-specific behavior. While the core functionality is not affected, we recognize the importance of proper process cleanup for production environments.

Contributing

If you have experience with this issue or have found alternative solutions, please share your findings. We welcome pull requests that address this problem while maintaining compatibility across all supported platforms.


Important

This issue is being tracked pending resolution in the upstream Playwright project, but we're actively working on MCP-specific workarounds.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions