---
title: OCP CLI v2 migration guide
slug: optimizely-connect-platform/docs/ocp-cli-v2-migration
docTags: 
createdAt: 2026-07-23T12:37:04.527Z
---

Use the following guide to migrate from Optimizely Connect Platform (OCP) CLI v1 to v2.

## New in v2

OCP CLI v2 introduces several new features and improvements, including the following:

- **Multiple package manager support** – Lets you use your preferred package manager.
- `ocp updated` – Lets you update the CLI to the latest version by displaying the list of available versions (`ocp update --available`)
- `ocp autocomplete` – Contains Shell autocompletion for commands and options, including Bash, Zsh, and PowerShell. You need PowerShell 7+ to autocomplete Windows. Run the command and follow the instructions provided in the terminal to autocomplete.
- **Flexible parameter syntax** – Supports both `--param value` and `--param=value` syntaxes, for example, `ocp app validate --path /Users/foo/my-app/` and `ocp app validate --path=/Users/foo/my-app/`.

## Install OCP CLI v2

### Uninstall CLI v1

1. Uninstall OCP CLI v1 if you installed it globally through `yarn` to avoid conflicts.

```bash
yarn global remove @optimizely/ocp-cli
```

2. Ensure `ocp` command is unavailable.

```bash
which ocp           # macOS/Linux
Get-Command ocp     # Windows (powershell)
# Should return no result
```

### Install OCP CLI v2

Explicitly request the latest beta version when running the installation script, as the default behavior is to fetch the stable release.

- Run the following Bash or Zsh script for MacOS or Linus:

```bash
curl -fsSL https://cli.ocp.optimizely.com/install.sh | bash
```

- Run the following PowerShell script for Windows:

```powershell
iwr -useb  https://cli.ocp.optimizely.com/install.ps1 | iex
```

Avoid global installations of this package using `yarn` or `npm`. Global installations tie the CLI to the Node.js runtime version on individual machines, which can lead to unexpected conflicts and inconsistent behavior.

Instead, use the script-based approach. This method ensures the CLI operates independently of the user's local Node.js runtime, providing a more stable and predictable experience.

### Verify installation

Run the following script:

```bash
ocp --version
# Should show v2.x.x (e.g., "ocp-cli v2.0.0-beta.5")
# If you see v1.x.x, the old CLI is still in your PATH - see "Uninstall old CLI" section above
```

### Run OCP CLI commands using `npx`

You can run OCP CLI commands directly using `npx`, without requiring any installation. However, ensure your shell has the correct Node.js runtime version for the application to function as expected.

```bash
npx @optimizely/ocp-cli-v2 app init
npx @optimizely/ocp-cli-v2 app validate
npx @optimizely/ocp-cli-v2 app package
```

## Package manager support

OCP CLI v2 supports multiple package managers for applications running Node.js 22+ environments, including Yarn (Berry and v3+), npm, pnpm, and Bun.

Use any of these package managers in your project. The build system automatically detects your package manager from the project configuration.

:::hint{type="info"}
**📘 Note**
Package manager support is for Node.js 22+ runtime only. Applications using older runtimes should continue using Yarn. See the [Node 22 migration guide](docId\:hZKIHzcLNzsnpYLNMeT5k) for upgrading your app's runtime.
:::

## Migrating from Yarn 1

For applications using Node.js 22+ that require a different package manager, such as npm, pnpm, Bun, or Yarn Berry, see [Package manager migration guide](docId\:phuhyycK8yV0Wo5EcqHlb)

### Prerequisites

- You must migrate to OCP CLI v2.
- You must have an application running on Node.js 22+ runtime.

### Validate your app

After installation, execute the following validation command to ensure it runs smoothly. A successful validation indicates your application is functional and ready for v2.

```bash
ocp app validate
```

## Quickstart to migration

1. Uninstall OCP CLI v1 if previously installed through `yarn` or `npm`.
2. Install OCP CLI v2 or use it directly through `npx`.
3. Confirm you are on v2 by executing `ocp --version`. The expected output is `v2.x.x`.
4. Run `ocp app validate` to ensure full functionality.
5. (Optional) See [Package manager migration guide](docId\:phuhyycK8yV0Wo5EcqHlb) if you are using Node.js 22+ and want to migrate from Yarn 1.
