Sync a folder with the CLI
Install the treehouse command-line tool to sync a folder from a terminal instead of the desktop app.
The treehouse CLI keeps a folder in sync with a workspace, just like the desktop app, from a terminal. Use it when you'd rather not run the desktop app, such as on a headless Mac where your agents run. It uses the same sync engine as the desktop app, so how sync works applies here too.
Steps
- Install the CLI.terminal
curl -fsSL https://dl.trytree.house/install.sh | sh
This installstreehouseto~/.local/bin. If that isn't on yourPATH, the installer tells you the line to add.
The installer checks the download's checksum and doesn't need admin rights. - Connect a folder:terminal
treehouse login ~/my-folder - 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.
- Choose the workspace to sync and select Connect to followed by its name.
- When you see You're connected 🌳, go back to the terminal.
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.
Check it worked
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 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.
Troubleshooting
The installer says my platform isn't supported
The CLI runs on macOS on Apple silicon for now. Windows and Linux are coming soon, and Intel Macs aren't supported yet. Use the web app there for now.
treehouse: command not found
The install folder isn't on your PATH. Add export PATH="$HOME/.local/bin:$PATH" to your shell profile.
Related
- Sync 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
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
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.
Last updated
