Check Playwright Installation on Mac: CLI & Browsers
In this article
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
- Open Terminal. Press
Cmd+Space, type “Terminal”, and hit Enter. - Check if Playwright is installed globally. Run:
playwright --version. If it prints a version number likeVersion 1.48.0, the CLI is installed globally. If you see “command not found”, it’s not installed globally. - 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. - Verify the npm package is listed. In your project folder, run:
npm list playwright. If it showsplaywright@x.x.x, it’s installed as a dependency. For the test runner, usenpm list @playwright/test. - Check installed browsers. Run:
npx playwright install --list. This lists which browsers are already downloaded and which are missing. For example, it might showchromium,firefox, andwebkitwith paths like~/Library/Caches/ms-playwright/chromium-1148. - Verify browser executables exist. For a specific browser, run:
ls ~/Library/Caches/ms-playwright/. You should see folders likechromium-*,firefox-*, andwebkit-*if they were installed. - Run a quick test (optional). If you have a test file, run
npx playwright testto 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 --versionchecks globally;npx playwright --versionchecks 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 runnpx playwright installseparately. - 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
playwrightpackage includes the CLI, but if you only installed@playwright/test, you still need to usenpx playwrightto access the CLI.
Tips
- Use
npx playwright install --with-depson 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@latestand thennpx playwright installto get new browser builds. - Check the Playwright version and browser revision in
package.jsonorplaywright.config.jsto ensure consistency. - If you use a CI system, always run
npx playwright installin 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.