By Ryan Hanson, creator of Rectangle · Tested on macOS 15.5 with Rectangle 0.96 · Updated July 2026
The short version: Most people never need it, but Rectangle app has a companion command line tool that lets its snap actions be triggered from the terminal — useful for scripting, chaining into shell workflows, or calling from other programs. It’s a niche feature aimed squarely at people already comfortable in the terminal, not a replacement for keyboard shortcuts in day-to-day use.
What it is and who it’s for
The Rectangle CLI is a separate command line companion to the main app — it doesn’t replace the GUI or the keyboard shortcuts, it adds another way to trigger the same snap actions, this time from a terminal command instead of a key combination. It communicates with the running Rectangle app rather than duplicating its logic, so the main app still needs to be installed and running for the CLI to do anything.
This is aimed at a specific audience: people who already script parts of their macOS setup, use the terminal as a primary tool, or want to trigger window arrangements from something other than a keypress — a shell script, a scheduled task, or another command line program that needs to arrange a window as part of a larger job.
Installing it
The CLI is typically installed separately from the main app, commonly through Homebrew for people who already manage their command line tools that way. Because it’s a companion to the GUI app rather than a standalone replacement, the main Rectangle app needs to already be installed and running with Accessibility permission granted — the CLI is a messenger, not an independent window manager.
Basic usage
Once installed, the general pattern is a command followed by the name of the action you want — the equivalent of whatever a keyboard shortcut would trigger, like snapping left, maximizing, or moving to the next display. The exact command names and syntax are documented on Rectangle’s own site, and it’s worth checking the current documentation directly rather than an old example, since command names have occasionally changed between versions.
A single command run manually in the terminal isn’t faster than a keyboard shortcut — that’s not the point. The value shows up once that command becomes one line in something bigger.
What it’s actually good for
Shell scripts. A setup script that opens a project, launches an editor and terminal, and arranges both windows in one run can include a Rectangle CLI call as its final step, turning several manual actions into a single script execution.
Conditional logic. Because it’s a terminal command, it can sit inside an if-statement or loop in a script — snap a window only if a certain condition is met, something a static keyboard shortcut has no way to express.
Integration with other command line tools. For people already gluing together several command line utilities to manage their environment, the Rectangle CLI slots in as one more piece — callable from cron jobs, other scripts, or tools that themselves shell out to run commands.
How it compares to the Shortcuts app integration
Rectangle also supports a URL scheme usable from Apple’s Shortcuts app, which serves a similar goal — triggering snap actions outside of keyboard shortcuts — through a different mechanism. The CLI fits naturally into terminal-based and shell-script workflows; the Shortcuts integration fits naturally into Apple’s own automation ecosystem, including Siri and scheduled Shortcuts automations. Which one makes sense depends entirely on where the rest of your automation already lives — there’s no reason to use both for the same task, just whichever matches the tools you’re already comfortable in.
Who can skip this entirely
To be direct about it: almost everyone. Rectangle’s keyboard shortcuts and drag-to-snap cover the overwhelming majority of daily window management, and the CLI adds nothing for that use case — it’s strictly slower to type a terminal command than to press a shortcut you’ve already memorized. This feature exists specifically for the smaller group of people who are already scripting their environment and want window arrangement to be one more thing a script can do, not a general recommendation for typical use.
Quick reference
What it is — A terminal companion to the main Rectangle app, not a replacement.
Requires — The main app installed, running, and with Accessibility permission already granted.
Best for — Shell scripts, conditional logic, integration with other command line tools.
Not needed for — Normal day-to-day window snapping; shortcuts are faster.
The bottom line
The Rectangle CLI is a small, well-targeted feature for a specific kind of user — someone already comfortable scripting their Mac who wants window arrangement to be one more command they can call rather than a manual action. For everyone else, it’s safe to ignore entirely; keyboard shortcuts remain the faster and more natural way to use Rectangle day to day.
Whether you use Rectangle app with CLI or Rectangle mac for shortcuts, both make window management effortless.
Frequently asked questions
Does Rectangle have a command line interface?
Yes, a companion command line tool exists for Rectangle that lets its window actions be triggered from the terminal rather than only through keyboard shortcuts or the app’s own UI, useful for scripting and integration with other tools.
How do I install Rectangle’s CLI?
It’s typically installed separately from the main Rectangle app, often through Homebrew, and requires the main Rectangle app to already be installed and running since the CLI communicates with it rather than replacing it.
What can I do with the Rectangle CLI that shortcuts can’t?
The CLI is most useful for scripting: triggering a snap action as one step in a shell script, calling it from another program, or combining it with conditional logic that a static keyboard shortcut can’t express on its own.
Is the CLI necessary for most Rectangle users?
No. The vast majority of Rectangle users never need it, since keyboard shortcuts and drag-to-snap cover normal daily use. The CLI is aimed specifically at people scripting their environment or integrating window management into other tools.
Written and tested by Ryan Hanson, creator of Rectangle, on macOS 15.5.