---
title: "Sync a folder with the CLI"
description: "Install the treehouse command-line tool to sync a folder on Windows, Linux, a server or any machine where the desktop app doesn't run."
canonical_url: "https://trytree.house/docs/desktop/sync-with-the-cli"
last_updated: "2026-09-29"
---

# Sync a folder with the CLI

Install the treehouse command-line tool to sync a folder on Windows, Linux, a server or any machine where the desktop app doesn't run.

The `treehouse` CLI keeps a folder in sync with a workspace, just like the desktop app, from a terminal. Use it on Windows and Linux, on a headless machine, or on a server where your agents run. It uses the same sync engine as the desktop app, so [how sync works](https://trytree.house/docs/desktop/how-sync-works) applies here too.

> **Note**
>
> Ready-made builds are available for **macOS on Apple silicon**, **Linux on arm64** and **Windows** (it runs under emulation on Windows on Arm). Builds for Linux on x64 and Intel Macs are paused for now.

## Steps

1. Install the CLI.
   On macOS or Linux:
   ```bash
   curl -fsSL https://dl.trytree.house/install.sh | sh
   ```
   This installs `treehouse` to `~/.local/bin`. If that isn't on your `PATH`, the installer tells you the line to add.
   On Windows, in PowerShell:
   ```powershell
   irm https://dl.trytree.house/install.ps1 | iex
   ```
   This installs `treehouse.exe` and adds it to your `PATH`. Open a new terminal afterwards.
   Both installers check the download's checksum and don't need admin rights.
2. Connect a folder:
   ```bash
   treehouse login ~/my-folder
   ```
3. Your browser opens at **Approve this device**. Check the code matches the one in your terminal. On a machine without a browser, open the address the command prints on any device you're signed in on.
4. Choose the workspace to sync and select **Connect to** followed by its name.
5. When you see **You're connected 🌳**, go back to the terminal.

![The Approve this device page, showing a code to check against the terminal and a list of workspaces to choose from](https://trytree.house/docs/images/device-approve.webp)

The code is valid for 10 minutes. If it expires, run `treehouse login` again.

The folder now syncs in the background. The sync process starts automatically when you log in to the computer: through launchd on macOS, a systemd user service on Linux (or an autostart entry where systemd isn't available), and a logon task on Windows.

## Check it worked

```bash
treehouse status
```

Your folder is listed with its state. Add a file to the folder and it appears in the workspace within a few seconds.

## Everyday commands

| Command | What it does |
| --- | --- |
| `treehouse status` | Show every synced folder and its state. |
| `treehouse pause [folder]` | Pause syncing a folder. It stays connected. |
| `treehouse resume [folder]` | Resume a paused folder. |
| `treehouse logs -f` | Follow the sync log live. `treehouse logs --path` prints where the logs are. |
| `treehouse update` | Download and install the latest version, then restart the background process. |
| `treehouse relocate <folder> <new-path>` | Move a synced folder and keep it connected. |
| `treehouse unlink [folder]` | Stop syncing a folder. Its files stay where they are. |
| `treehouse stop` / `start` / `restart` | Stop the background process (and its autostart), start it, or restart it. |
| `treehouse sync [folder] --watch` | Sync in the foreground instead, until you press Ctrl+C. Without `--watch` it syncs once and exits. |

Run `treehouse help` for the full list, or see the [CLI reference](https://trytree.house/docs/desktop/cli-reference) for every command and flag.

On a Mac with the desktop app, the CLI and the app share one list of synced folders and one background process, so either can manage any folder.

> **For agents**
>
> Changes made through a folder synced with the CLI are attributed to the person who approved the device, not to you as an agent. If you need your changes labelled as an agent's, connect over MCP with an API key instead. See [how agents work with Treehouse](https://trytree.house/docs/agents/connect/how-agents-work).

## Troubleshooting

### The installer says my platform isn't supported

Ready-made builds cover macOS on Apple silicon, Linux on arm64 and Windows. On other machines, such as Linux on x64, the installer stops with a message. Use the web app there for now.

### `treehouse: command not found`

The install folder isn't on your `PATH`. On macOS and Linux, add `export PATH="$HOME/.local/bin:$PATH"` to your shell profile. On Windows, open a new terminal.

## Related

- [Sync CLI reference](https://trytree.house/docs/desktop/cli-reference): Every treehouse command and flag, the files and environment variables the CLI reads, and the safety rules it follows while syncing.
- [How sync works](https://trytree.house/docs/desktop/how-sync-works): What the sync engine does in the background, which files it skips, and how it protects your work when things go wrong.
- [Manage synced folders](https://trytree.house/docs/desktop/manage-synced-folders): Check sync status, pause, move or stop syncing a folder, add another workspace, and sign out, all from the Treehouse icon in your menu bar.
