# Installation and CLI usage

{% tabs %}
{% tab title="Ubuntu" %}
**Have** **npm and Node.js installed already? Skip to step 6. If not, read below**

1. Update your repo

```bash
sudo apt-get update --yes
```

2. Install npm

```bash
sudo apt-get install npm --yes
```

3. Install Node Version Manager

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
```

4. Update the terminal

```bash
source ~/.bashrc
```

5. Install Node.js version 20

```bash
nvm install 20
```

6. Use Node.js version 20

```bash
nvm use 20
```

7. Install the anyone-client

```bash
npm install @anyone-protocol/anyone-client
```

8. If you wish to use it personally, start the anyone-client.&#x20;

```bash
npx anyone-client
```

Resource: <https://www.npmjs.com/package/@anyone-protocol/anyone-client>
{% endtab %}

{% tab title="macOS" %}
**Have** **npm and Node.js installed already? Skip to step 4. If not, read below**\
\
NPM installation replicates the installation guide [here](https://nodejs.org/en/download/package-manager). You can follow this guide on the Terminal app on your Mac.&#x20;

1. Install nvm by&#x20;

```
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
```

2. Use nvm to install Node.js 20

```
nvm install 20
```

3. Verify that you have installed Node.js and npm by ensuring you get a version code for each of these commands

```
node -v
npm -v
```

4. Install the anyone-client

```bash
npm install @anyone-protocol/anyone-client
```

5. If you wish to use it personally, start the anyone-client.&#x20;

```bash
npx anyone-client
```

Resource: <https://www.npmjs.com/package/@anyone-protocol/anyone-client>
{% endtab %}

{% tab title="Windows" %}
**Have** **npm and Node.js installed already? Skip to step 4. If not, read below**\
\
NPM installation replicates the installation guide [here](https://nodejs.org/en/download/package-manager). You can follow this guide on the Command Prompt app on your Desktop.

1. Install fnm (fast node manager) by&#x20;

```
winget install Schniz.fnm
```

2. Use fnm to install Node.js 20

```
fnm env --use-on-cd | Out-String | Invoke-Expression
fnm use --install-if-missing 20
```

3. Verify that you have installed Node.js and npm by ensuring you get a version code for each of these commands

```
node -v
npm -v
```

4. Install the anyone-client

```bash
npm install @anyone-protocol/anyone-client
```

5. If you wish to use it personally, start the anyone-client.&#x20;

```bash
npx anyone-client
```

Resource: <https://www.npmjs.com/package/@anyone-protocol/anyone-client>
{% endtab %}
{% endtabs %}

## Run from CLI

The Anyone Protocol NPM package provides a command-line interface (CLI) that allows you to easily run and configure the Anyone client. This page details how to use the CLI and the available options.

### Running the Anyone Client

To run the Anyone client using the CLI, use the following command:

```sh
npx anyone-client
```

This command will start the client with default port settings.

### Default Port Settings

When run without any options, the Anyone Client uses the following default ports:

* SocksPort: 9050
* ControlPort: 9051
* OrPort: 9001

### CLI Options

You can customize the client's behavior using various command-line options:

| Option | Description                                 | Default  |
| ------ | ------------------------------------------- | -------- |
| `-s`   | Set the SocksPort                           | 9050     |
| `-c`   | Set the ControlPort (use 0 to disable)      | 9051     |
| `-o`   | Set the OrPort                              | 9001     |
| `-v`   | Enable verbose mode for full client logs    | Disabled |
| `-f`   | Set the path to a custom anonrc config file | None     |
| `-b`   | Set the path to a custom anon binary        | None     |

#### Example Usage

Here's an example of how to use these options:

```sh
npx anyone-client -s 9150 -c 0 -o 9101 -f ./customAnonrc -b /usr/local/bin/anon -v
```

This command will:

* Set the SocksPort to 9150
* Disable the ControlPort
* Set the OrPort to 9101
* Use a custom anonrc file located at './customAnonrc'
* Use a custom anon binary located at '/usr/local/bin/anon'
* Enable verbose mode

### Important Notes

1. When changing ports, ensure they don't conflict with other services on your system.
2. The `-b` option allows you to use a preinstalled anon binary instead of the one that comes with the package.

### Terms and Agreements

To bypass the user agreement automatically, you can create a file named 'terms-agreement' in the working directory. This file should contain the line 'agreed' to be considered valid.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anyone.io/sdk/npm/install.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
