User Agents

Web browsers and everyday web tech, explained

Check Playwright Installation on Mac: CLI & Browsers

· 4 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to verify that Playwright is installed on your Mac, both as a command-line tool and with its browser binaries. You'll learn the exact commands to run and how to interpret their output, so you can confirm your setup before writing or running tests.

What You'll Need

  • macOS with a terminal (Terminal.app or iTerm)
  • Node.js installed (version 18 or newer recommended for recent Playwright versions)
  • npm or yarn (usually comes with Node.js)

Step-by-Step

  1. Open Terminal. Press Cmd+Space, type “Terminal”, and hit Enter.
  2. Check if Playwright is installed globally. Run: playwright --version. If it prints a version number like Version 1.48.0, the CLI is installed globally. If you see “command not found”, it’s not installed globally.
  3. Check for a local installation in your project. Navigate to your project folder: cd /path/to/your/project. Then run: npx playwright --version. This will use the locally installed version if present, or prompt to install it if not.
  4. Verify the npm package is listed. In your project folder, run: npm list playwright. If it shows playwright@x.x.x, it’s installed as a dependency. For the test runner, use npm list @playwright/test.
  5. Check installed browsers. Run: npx playwright install --list. This lists which browsers are already downloaded and which are missing. For example, it might show chromium, firefox, and webkit with paths like ~/Library/Caches/ms-playwright/chromium-1148.
  6. Verify browser executables exist. For a specific browser, run: ls ~/Library/Caches/ms-playwright/. You should see folders like chromium-*, firefox-*, and webkit-* if they were installed.
  7. Run a quick test (optional). If you have a test file, run npx playwright test to see if everything works end-to-end. If it runs without errors about missing browsers, your installation is complete.

Common Mistakes

  • Confusing global and local installs. playwright --version checks globally; npx playwright --version checks the project’s local node_modules. You might have one but not the other.
  • Not installing browsers after npm install. Playwright does not download browsers automatically when you run npm install playwright. You must run npx playwright install separately.
  • Using the wrong cache path. On Mac, browsers are stored in ~/Library/Caches/ms-playwright, not in the project folder. If you look in node_modules, you won’t find them.
  • Assuming the CLI is installed when only the library is. The playwright package includes the CLI, but if you only installed @playwright/test, you still need to use npx playwright to access the CLI.

Tips

  • Use npx playwright install --with-deps on macOS to install system dependencies automatically (though macOS usually has most of them).
  • If you work on multiple projects, install Playwright locally in each project to avoid version conflicts.
  • To update Playwright, run npm install @playwright/test@latest and then npx playwright install to get new browser builds.
  • Check the Playwright version and browser revision in package.json or playwright.config.js to ensure consistency.
  • If you use a CI system, always run npx playwright install in the build steps.

Troubleshooting

“command not found: playwright”
This means the CLI is not installed globally. Either install it globally with npm install -g playwright, or use npx playwright from your project.

“npx playwright --version” prompts to install
This means Playwright is not in your project’s node_modules. Run npm install --save-dev @playwright/test (or npm install playwright) first.

“Executable doesn't exist” error when running tests
Browsers are not installed. Run npx playwright install to download them.

Browsers install but tests still fail
Try clearing the cache: rm -rf ~/Library/Caches/ms-playwright and then reinstall with npx playwright install. Also ensure your macOS version is supported (Playwright supports macOS 12+ for recent versions).

Permission errors when installing browsers
If you see EACCES errors, try running with sudo (though not recommended) or fix the permissions on the cache folder: sudo chown -R $(whoami) ~/Library/Caches/ms-playwright.

Version mismatch between CLI and browsers
If you update Playwright but not browsers, you might get errors. Always run npx playwright install after updating the package.

Frequently Asked Questions

Do I need to install Playwright globally?

No. It’s recommended to install it locally in each project to avoid version conflicts. The npx command will use the local version.

How do I know which browsers are installed?

Run npx playwright install --list. It shows each browser and its installation status.

Can I install only one browser?

Yes. For example, npx playwright install chromium installs only Chromium. Use firefox or webkit for others.

What is the default cache location on Mac?

Browsers are stored in ~/Library/Caches/ms-playwright.

Do I need to install browsers separately for each project?

No, browsers are shared across projects. They are stored in the global cache, so installing once is enough for all projects using the same Playwright version.

How do I uninstall Playwright?

Remove the package from your project with npm uninstall playwright or npm uninstall @playwright/test. To remove the browsers, delete the cache folder ~/Library/Caches/ms-playwright.