Trimmy flattens copied shell snippets so they paste as one command
"Paste once, run once." — Trimmy flattens those multi-line shell snippets you copy so they actually paste and run.
At a glance
- What is it?
- Trimmy is a macOS menu bar app that watches the clipboard and rewrites multi-line shell snippets into a single pasteable line, using command cues and a per app sensitivity setting. It ships a headless CLI, keeps clipboard data local, and needs macOS 15 on Apple silicon.
- Who is it for?
- Trimmy suits someone who copies command blocks from documentation or chat and then fights with a terminal that runs only the first line, since the cue based detection handles pipes, redirects and line continuations without mangling ordinary prose or code. It is the wrong tool if you are on anything other than macOS 15 on Apple silicon, and it is the wrong tool for a machine where you cannot grant Accessibility permission, since the manual paste actions depend on it.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly Swift, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The problem is a terminal that runs only the first line
Trimmy is a macOS menu bar app that turns copied multi-line shell snippets into one pasteable command. It watches the clipboard and uses command cues plus configurable sensitivity to avoid rewriting ordinary prose and code.
The example in the README makes the problem concrete. You copy a three line block:
printf '%s\n' \
'Trimmy' \
'is ready'and the clipboard entry shows the joined form, with a comment recording the transformation. A terminal that receives the original three lines runs the first and treats the rest as arguments to the running command, which is the classic frustrating outcome of copying a block from a README.
So the pitch is paste once, run once. Trimmy rewrites the copy once, and the next paste is a single command.
The install path is a cask:
brew install --cask steipete/tap/trimmyand the alternative is to download the signed app from GitHub Releases, with Sparkle checking for app updates after installation. The requirement is narrow but explicit: an Apple silicon Mac running macOS 15 or later.
Four sensitivity levels, and what each one erases
The core design decision is a sensitivity level, and there are four of them, with different behaviour in general applications and in terminals.
None disables command flattening in general apps, though optional text reflow still applies. Low requires strong cues such as pipes, redirects or backslash continuations. Normal handles typical multi-line commands with flags, and it is the terminal default. High flattens most command-shaped text, and the manual Paste Trimmed action always uses this level.
The defaults are Low in general apps and Normal in terminals, and the rationale is visible in the heuristics. Prompt gutters such as $ and # are removed when separated from a command by whitespace, while shell variable references such as $HOME/bin/tool and Markdown headings such as # GitHub Actions remain intact. Large clipboard blobs are skipped as a safety valve, and filesystem notes such as /etc are left alone.
URL repair is the subtlest of these rules. It preserves same-line trailing prose and multiword prose lines, while still joining path, query or fragment components copied as token-only continuation lines.
The formatting-sensitive cases are handled explicitly too. Low and Normal sensitivity preserve YAML block scalars and their required indentation, while High sensitivity and the manual Paste Trimmed action still flatten on request.
Paste actions, and the permission they need
Paste Trimmed and Paste Original can be assigned global shortcuts, and clearing a shortcut keeps it unset after restarting Trimmy. The menu previews name the target app and show what trimming removed before sending the paste keystroke, which is a good detail, because a tool that silently changes your clipboard deserves to be observable.
Manual pastes use the latest copy and temporarily replace the clipboard, then restore every available item and format unless another app has copied something newer in the meantime.
The permission model is stated plainly. These paste actions need macOS Accessibility permission, and Trimmy prompts for it when necessary and links to System Settings, then Privacy and Security, then Accessibility. Automatic clipboard rewriting still works without simulated paste access.
That distinction is the useful one. The core feature, watching the clipboard and rewriting it, needs no special permission. Only the ability to press the paste key for you needs Accessibility, and a user who is uneasy about that can leave it off and still get the rewritten clipboard.
Whatever trimming removed is shown in the menu preview, and Paste Original is always available from the menu whenever you need the untouched copy.
Reflow, box drawing and URL cleanup are separate actions
Beyond command flattening, Trimmy has a set of cleanup actions that are opt-in and, in the case of the main one, off by default.
Settings, then General, then Automatically reflow copied text joins hard-wrapped prose and Markdown during Auto-Trim. It defaults off, respects app and site exclusions, and preserves headings, lists, paragraph breaks and fenced code. Recognised source code and configuration are excluded from reflow. The manual Paste Reflowed Text action uses the same checks, and optional removal of leading blank lines also defaults off. Recognised documents are reflowed before command cleanup, so fenced examples stay intact. Closing fences require only trailing spaces or tabs, and numbered list markers require one to nine ASCII digits followed by a period or parenthesis and whitespace. Wrapped Markdown links are rejoined during text reflow while inline code and parenthetical prose stay spaced.
There is also a separate action that removes URL query parameters while retaining configured identity parameters such as YouTube video IDs, GitHub tabs and Figma node IDs.
Box-drawing gutters such as │ and ┃ can be removed from copied terminal output without stripping real shell pipes, and paths containing spaces are quoted for the shell while preserving literal dollar signs, backticks, backslashes and quotes, with a leading ~/ still expanding to the home directory. Command continuations accept LF, CRLF and CR line endings.
All of this is a set of small careful rules, and the reason the sensitivity levels exist at all is that the rules cannot all be applied at once without breaking something.
A headless CLI on the same engine
TrimmyCLI uses the same trimming engine without the menu bar app, and it runs from the source checkout:
printf '%s\n' 'echo hello \' ' world' | swift run TrimmyCLI --trim --forceThe result is echo hello world, so the same transformation that the app performs on your clipboard is available as a filter you can put in a pipeline.
The packaged app can install a trimmy command from Settings, then Advanced, and Linux binaries are attached to GitHub Releases. The CLI reference at docs/cli.md covers file input, JSON output, all the options and the exit codes.
That CLI is the part that makes the tool usable in a script, and it is the part that makes the project testable. The core library, TrimmyCore, owns the shared text-cleaning pipeline, its tests and the CLI tests run on macOS and Linux, and TrimmyTests covers the macOS clipboard and UI integration. SwiftPM includes the app dependencies only on macOS.
The build requirements are Swift 6.3 and macOS 15 or later, and the README notes you need to install a Swift 6.3 toolchain if your Xcode version bundles an older compiler. Development opens Package.swift in Xcode, or uses the package scripts, where the build and test recipes select SwiftPM's native backend to retain static Linux linking and the package layout on Swift 6.4.
How the clipboard watching actually works
The how it works section is four bullets, and they are enough to explain the design.
A roughly 150 ms timer watches for pasteboard ownership changes, followed by an 80 ms grace period for promised clipboard data. The two numbers together are the latency budget of the whole product, since a change detected and a rewrite completed both sit on that path.
Clipboard writes carry a com.steipete.trimmy marker so that Trimmy does not process its own output. Without that, the app would rewrite its own rewrite, and a snippet that flattens differently the second time would settle into a different form than the one you saw.
Clipboard content stays local. Trimmy has no telemetry and no account system, and its network use is Sparkle's update check. That is a meaningful property for a tool whose entire job is reading everything you copy, and it is stated as a fact rather than a promise about the future.
The technical specification at docs/spec.md covers the detection heuristics, the settings and the pasteboard behaviour in more detail, and the project keeps a CHANGELOG.md and a version.env alongside the Swift sources, Scripts directory, bin directory, docs directory and tests directory.
Editorial conclusion
Trimmy suits someone who copies command blocks from documentation or chat and then fights with a terminal that runs only the first line, since the cue based detection handles pipes, redirects and line continuations without mangling ordinary prose or code. It is the wrong tool if you are on anything other than macOS 15 on Apple silicon, and it is the wrong tool for a machine where you cannot grant Accessibility permission, since the manual paste actions depend on it. Before relying on it, install the cask, copy the three line printf example, paste it into a terminal, and check the result, then set the terminal sensitivity to Normal and leave general apps on Low until you trust the heuristics.
Frequently asked questions
How do I install Trimmy on macOS?
On an Apple silicon Mac running macOS 15 or later, run brew install --cask steipete/tap/trimmy. You can also download the signed app from GitHub Releases, and Sparkle checks for app updates after installation.
What do the Trimmy sensitivity levels do?
None disables command flattening in general apps, Low requires strong cues such as pipes, redirects or backslash continuations, Normal handles typical multi-line commands with flags and is the terminal default, and High flattens most command-shaped text and is what the manual Paste Trimmed action always uses.
Does Trimmy send my clipboard anywhere?
No. The README states that clipboard content stays local, that Trimmy has no telemetry or account system, and that its network use is Sparkle's update check. The paste actions need macOS Accessibility permission, while automatic clipboard rewriting works without it.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/steipete-trimmy)Was this useful?