{"slug": "stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and", "title": "Stop Downloading Duplicate Browsers: Use System Chrome with Puppeteer and Playwright", "summary": "A developer reclaimed more than 4 GB of disk space on macOS by configuring Puppeteer and Playwright to use the system-installed Google Chrome instead of downloading separate browser builds. The approach involves setting the PUPPETEER_EXECUTABLE_PATH environment variable and using Playwright's 'chrome' channel, which allows local automation to run without duplicate browser downloads. The developer notes this is a local-development optimization and not a replacement for Playwright's pinned browsers.", "body_md": "Browser automation tools are convenient until each project quietly downloads another browser. On macOS, Puppeteer and Playwright can each keep several gigabytes of Chromium builds in their caches, even when Google Chrome is already installed and up to date.\n\nFor local automation that only needs Chrome, I use the system browser instead. That reclaimed more than 4 GB on my machine and still lets Puppeteer, Playwright Test, Playwright CLI, and Playwright MCP do their jobs.\n\nThis is a local-development optimization, not a replacement for Playwright's pinned browsers. Keep reading for the trade-offs.\n\nPuppeteer and Playwright keep their downloaded browsers in separate macOS caches. Check their sizes before deleting anything:\n\n```\ndu -sh ~/.cache/puppeteer 2>/dev/null\ndu -sh ~/Library/Caches/ms-playwright 2>/dev/null\n```\n\n`~/.cache/puppeteer`\n\ncontains Puppeteer's downloaded Chrome or Chrome for Testing builds. `~/Library/Caches/ms-playwright`\n\ncontains the browsers installed for Playwright.\n\nFirst make sure that regular Google Chrome is installed at the standard macOS location:\n\n```\ntest -x \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" \\\n  && echo \"Google Chrome is available\"\n```\n\nSet `PUPPETEER_EXECUTABLE_PATH`\n\nto make Puppeteer use the already-installed Google Chrome executable:\n\n```\nexport PUPPETEER_EXECUTABLE_PATH=\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"\n```\n\nAdd that export to the shell profile you use for local automation, such as `~/.zshrc`\n\n, if it should persist between terminals.\n\nPuppeteer can also be configured explicitly in code. This is useful when a project should be self-contained instead of relying on its caller's environment:\n\n``` python\nimport puppeteer from 'puppeteer';\n\nconst browser = await puppeteer.launch({\n  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',\n  headless: true,\n});\n\nconst page = await browser.newPage();\nawait page.goto('https://example.com', { waitUntil: 'networkidle2' });\nawait page.pdf({ path: 'example.pdf', format: 'A4' });\nawait browser.close();\n```\n\nRun a real workflow, such as PDF generation, before removing the cache. It confirms that permissions, launch arguments, and any fonts used by your automation work with system Chrome.\n\nPlaywright treats installed, branded browsers as channels. Choosing the `chrome`\n\nchannel selects the regular Google Chrome installation rather than Playwright's bundled Chromium.\n\nFor Playwright Test, configure the project with `channel: 'chrome'`\n\n:\n\n``` js\nimport { defineConfig, devices } from '@playwright/test';\n\nexport default defineConfig({\n  projects: [\n    {\n      name: 'Google Chrome',\n      use: { ...devices['Desktop Chrome'], channel: 'chrome' },\n    },\n  ],\n});\n```\n\nFor one-off browsing with Playwright CLI, select the same channel:\n\n```\nplaywright-cli open https://example.com --browser=chrome\n```\n\nPlaywright MCP accepts the browser either as an argument or an environment variable:\n\n```\nnpx @playwright/mcp@latest --browser chrome\n\nexport PLAYWRIGHT_MCP_BROWSER=chrome\n```\n\nIf Chrome is installed somewhere nonstandard, Playwright MCP also provides `--executable-path`\n\nfor an explicit executable location.\n\nPassing `--browser=chrome`\n\nis explicit and works well for one-off commands. If every local `playwright-cli`\n\nsession should use regular Chrome, use the CLI's global configuration instead of a shell function. Create `~/.playwright/cli.config.json`\n\n:\n\n```\nmkdir -p ~/.playwright\n{\n  \"browser\": {\n    \"browserName\": \"chromium\",\n    \"launchOptions\": {\n      \"channel\": \"chrome\"\n    }\n  }\n}\n```\n\nThe global config applies to every `playwright-cli`\n\ncommand, including `open`\n\n, without modifying `~/.zshrc`\n\n. A project-level `.playwright/cli.config.json`\n\nor an explicit option still overrides it when a workflow needs a different browser:\n\n```\nplaywright-cli open https://example.com\nplaywright-cli open https://example.com --browser=firefox\n```\n\nThis environment variable prevents Playwright from downloading browser binaries:\n\n```\nexport PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1\n```\n\nIt does **not** tell Playwright which browser to launch. Without `channel: 'chrome'`\n\n, `--browser=chrome`\n\n, a Playwright CLI global or project config, `PLAYWRIGHT_MCP_BROWSER=chrome`\n\n, or another explicit configuration, a workflow may still expect Playwright's bundled Chromium.\n\nLikewise, `PUPPETEER_EXECUTABLE_PATH`\n\nselects an executable for Puppeteer; it does not remove browser files which have already been downloaded.\n\nOnce the Puppeteer script and relevant Playwright workflows succeed with Chrome, remove the downloaded browser caches:\n\n```\nrm -rf ~/.cache/puppeteer\nrm -rf ~/Library/Caches/ms-playwright\n```\n\nRun the size check again to confirm the disk space has been recovered:\n\n```\ndu -sh ~/.cache/puppeteer ~/Library/Caches/ms-playwright 2>/dev/null\n```\n\nThe next project that needs a managed browser can download it again. If cache location is the concern rather than cache size, Puppeteer supports `PUPPETEER_CACHE_DIR`\n\nand Playwright supports `PLAYWRIGHT_BROWSERS_PATH`\n\nto store downloads elsewhere.\n\nSystem Chrome is a good choice for local Chrome-only automation. It is not a substitute for the browser binaries pinned by Playwright:\n\nThe practical split is simple: use system Chrome for local automation that targets Chrome, and keep Playwright's managed browsers where cross-browser coverage and repeatability are part of the requirement.\n\n*Keep automating.* 🫡", "url": "https://wpnews.pro/news/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and", "canonical_source": "https://dev.to/romanpinchuk/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and-playwright-3flo", "published_at": "2026-08-02 11:09:53+00:00", "updated_at": "2026-08-02 11:44:23.771564+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Puppeteer", "Playwright", "Google Chrome", "macOS"], "alternates": {"html": "https://wpnews.pro/news/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and", "markdown": "https://wpnews.pro/news/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and.md", "text": "https://wpnews.pro/news/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and.txt", "jsonld": "https://wpnews.pro/news/stop-downloading-duplicate-browsers-use-system-chrome-with-puppeteer-and.jsonld"}}