The "worktray" command line tool
Open any folder or file in Worktray straight from your terminal, like code . or cursor .
Worktray for Mac can install a worktray shell command so you can open a folder as a tray from a terminal — the same way code . or cursor . work for other editors. It can also open a single file, or take text piped into it.
Install the command
Section titled “Install the command”- Open the command palette with Cmd+K.
- Type
>to switch to command mode. - Choose Install the “worktray” command line tool.
macOS will ask for your administrator password — the command is written to /usr/local/bin, which is a protected location. Once it confirms, the command is ready to use in any terminal.
Open a folder
Section titled “Open a folder”Run worktray with a path:
worktray . # open the current folderworktray ~/code/api # open a specific folderWorktray opens that folder as a folder-backed tray: its files stay ordinary files on disk, and changes you make in Worktray write straight back to the folder. If the folder isn’t already open, it’s added to your trays; if it is, Worktray just brings it to the front.
Open a file
Section titled “Open a file”worktray notes/plan.mdWorktray opens the folder the file lives in as a tray — or the tray you already have for a folder containing it — and opens the file there.
Pipe text in
Section titled “Pipe text in”pbpaste | worktray -git diff | worktray - changes.txtworktray - saves whatever is piped in as a new file in your Inbox tray (~/Worktray/Inbox) and opens it. See Open files and send text to Worktray for naming rules.
Choose the editor tab
Section titled “Choose the editor tab”Most editors have two tabs: one for editing the file’s source and one for viewing it. Add --view to open a file on its viewing tab, or --edit for its editing tab:
worktray --view README.mdgit log -20 | worktray - --view log.md| File | --edit opens |
--view opens |
|---|---|---|
| Markdown, HTML | Edit | Preview |
| JSON, YAML, XML | Raw | Tree |
| CSV/TSV | Raw | Table |
SVG, .theme |
Raw | Design |
.env |
Raw | Form |
.curl |
Raw | Fields |
.jwt |
Raw | Decoded |
.task |
Raw | Ticket |
.openapi |
Raw | Explore |
Without either flag, each editor opens on its usual tab: the viewing tab for CSV, SVG, .env, .task and .openapi, and the editing tab for everything else. Editors with a single view, such as plain text, code, images and PDFs, ignore the flag. The flag can go anywhere among the arguments, and it has no effect when you open a folder.
Open in the background
Section titled “Open in the background”Add --background to open a folder, a file or piped text without bringing Worktray to the front:
worktray --background report.htmlnpm test 2>&1 | worktray - --background test-output.txtIt opens exactly as it would otherwise, but your terminal keeps focus, so you can look when you’re ready. If Worktray isn’t running yet, it may come to the front as it starts, like any app launching; once it’s open, later --background opens stay behind. This is how the Claude Code plugin shows you results while Claude keeps working.
How it runs
Section titled “How it runs”The command returns immediately and leaves nothing running in your terminal — you can close the terminal window without being asked to end a process. If Worktray is already open, the folder or file opens in the existing window.
If you installed the command before Worktray 0.1.30, install it again from the command palette to get file, worktray -, and --view/--edit support. --background needs the command from Worktray 0.1.37 or later.
Uninstall the command
Section titled “Uninstall the command”Remove the installed command with:
sudo rm /usr/local/bin/worktrayStop using a folder in Worktray
Section titled “Stop using a folder in Worktray”To take a folder out of Worktray without touching it, open the tray switcher, open that tray’s menu, and choose Remove from Worktray. The folder and its files stay exactly where they are on disk; you can open it again later with worktray <path>.
Delete Folder, in the same menu, is different: it permanently deletes the folder and everything in it from disk. It does not go to the Trash.
If a folder goes missing
Section titled “If a folder goes missing”If you move or delete a folder that’s open as a tray, Worktray notices: the tray is marked Folder unavailable in the tray switcher with a Remove button, and opening it shows a notice instead of a stale, unsaveable file list. Move the folder back to pick up where you left off, or remove the tray.