Skip to content

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.

  1. Open the command palette with Cmd+K.
  2. Type > to switch to command mode.
  3. 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.

Run worktray with a path:

Terminal window
worktray . # open the current folder
worktray ~/code/api # open a specific folder

Worktray 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.

Terminal window
worktray notes/plan.md

Worktray 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.

Terminal window
pbpaste | worktray -
git diff | worktray - changes.txt

worktray - 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.

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:

Terminal window
worktray --view README.md
git 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.

Add --background to open a folder, a file or piped text without bringing Worktray to the front:

Terminal window
worktray --background report.html
npm test 2>&1 | worktray - --background test-output.txt

It 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.

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.

Remove the installed command with:

Terminal window
sudo rm /usr/local/bin/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 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.