---
title: Anchor CLI Basics
seoTitle: Introductory commands for getting started on the Anchor CLI
description:
  This section walks through some common Anchor CLI commands to get you started.
---

This section provides some common commands and examples to help you get started
using the [Anchor CLI](https://www.anchor-lang.com/docs).

<Steps>
<Step>

### Initialize the project

Create a new Anchor project by running the command shown below. It will create a
new directory with the project name and use it to initialize a new Anchor
project.

```terminal
$ anchor init <project-name>
```

For example, the command below will create a project called `my-project`. The
`my-project` directory will contain a modular Rust program and a Rust test
template that uses LiteSVM.

```terminal
$ anchor init my-project
```

To generate a TypeScript test template instead, choose one explicitly. For
example, use the Mocha template:

```terminal
$ anchor init my-project --test-template mocha
```

TypeScript test templates require Node.js and a JavaScript package manager.

Then navigate to the project directory:

```terminal
$ cd <project-name>
```

See Anchor's
[project file structure](https://www.anchor-lang.com/docs/quickstart/local#project-file-structure).

</Step>
<Step>

### Build the program

To build your project, run the following command:

```terminal
$ anchor build
```

You can find the compiled program in the `/target/deploy` directory.

<Callout type="warn" title="Platform tools failed to install">
  If the build reports an invalid platform-tools directory, reinstall the SBF
  build tools, then retry the build:

```terminal
$ cargo build-sbf --force-tools-install
$ anchor build
```

</Callout>

</Step>
<Step>

### Deploy the program

To deploy your project, run the following command:

```terminal
$ anchor deploy
```

This command deploys your program to the `cluster` specified in the
[`Anchor.toml`](https://www.anchor-lang.com/docs/references/anchor-toml) file.

</Step>
<Step>

### Test the program

To test your project, run the following command:

```terminal
$ anchor test
```

This command builds, deploys, and runs the tests for your project.

<Callout>
  When using the `localnet` cluster, Anchor automatically starts a local
  validator, deploys the program, runs tests, then stops the validator.
</Callout>

<Callout type="warn" title="JavaScript test runner errors">

If you selected a JavaScript or TypeScript test template, either of the
following errors may indicate that Node.js or the configured package manager is
not installed:

```
Permission denied (os error 13)
```

```
No such file or directory (os error 2)
```

</Callout>

</Step>
</Steps>
