6.2 KiB
title, description, keywords, sidebar_position
| title | description | keywords | sidebar_position | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Install Promptfoo | Learn how to install promptfoo using npm, npx, or Homebrew. Set up promptfoo for command-line usage or as a library in your project. |
|
4 |
import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Installation
Install promptfoo using npm, npx, or Homebrew (Mac, Linux):
```bash npm install -g promptfoo ``` ```bash npx promptfoo@latest ``` ```bash brew install promptfoo ```:::note
npm and npx require Node.js ^20.20.0 or >=22.22.0.
:::
Node.js runtime support
:::warning Node.js 20 support ends July 30, 2026 at 00:00 UTC
Node.js 20 has reached upstream end-of-life. Promptfoo releases after the support cutoff will
require Node.js 22.22.0 or newer. Node.js 24 LTS is recommended.
:::
Upgrade Node.js before updating promptfoo.
```bash nvm install 24 nvm use 24 ``` ```bash fnm install 24 fnm use 24 ``` ```bash volta install node@24 ``` Download a current LTS release from the [Node.js download page](https://nodejs.org/en/download).For CI, update the configured Node.js version to 24. For a custom Docker image, use a current
Node.js base image such as node:24. After switching runtimes, verify the active version with
node --version, then update promptfoo.
To suppress standalone runtime compatibility reminders in both the CLI and Web UI, set
PROMPTFOO_DISABLE_RUNTIME_WARNINGS=true. Update checks remain independent and may still explain
when the active Node.js version cannot install an available package update. Use
PROMPTFOO_DISABLE_UPDATE=true separately to disable those checks.
To use promptfoo as a library in your project, run npm install promptfoo --save.
Verify Installation
To verify that promptfoo is installed correctly, run:
```bash promptfoo --version ``` ```bash npx promptfoo@latest --version ``` ```bash promptfoo --version ```This should display the current version number of promptfoo.
Run Promptfoo
After installation, you can start using promptfoo by running:
```bash promptfoo init ``` ```bash npx promptfoo@latest init ``` ```bash promptfoo init ```This will guide you through the process of creating a promptfooconfig.yaml file.
For a guide on running your first evaluation, please refer to our Getting Started guide.
Uninstall Promptfoo
Remove the package
If you installed promptfoo with more than one method (for example, both npm and Homebrew), repeat the relevant steps for each.
```bash npm uninstall -g promptfoo ``` `npx` does not install promptfoo permanently — no uninstall step is needed. If you also have a global install (via npm or Homebrew), remove it using the corresponding tab. ```bash brew uninstall promptfoo ```If you installed promptfoo as a project dependency, remove it from your project:
```bash npm uninstall promptfoo ``` ```bash yarn remove promptfoo ``` ```bash pnpm remove promptfoo ```Verify removal
After uninstalling, confirm that promptfoo is no longer available globally:
```bash which -a promptfoo ``` ```bash where promptfoo ```If this still returns a path, you have another global installation that needs to be removed. Note that project-local installs (node_modules/.bin/promptfoo) are not detected by these commands — remove those with the project dependency step above.
Remove configuration and data (optional)
Promptfoo stores configuration, eval history, and cached results in ~/.promptfoo (%USERPROFILE%\.promptfoo on Windows). Uninstalling the package does not remove this directory.
:::warning This permanently deletes your eval history, database, and cached results. :::
```bash rm -rf ~/.promptfoo ``` ```powershell Remove-Item -Recurse -Force "$env:USERPROFILE\.promptfoo" ``` ```cmd rmdir /s /q "%USERPROFILE%\.promptfoo" ```If you set custom paths via environment variables, remove those directories as well:
PROMPTFOO_CONFIG_DIR— configuration and databasePROMPTFOO_CACHE_PATH— cached resultsPROMPTFOO_LOG_DIR— log files