The procowl CLI: commands, exit codes and scripting
Install the procowl command, see every command and time format, read its exit codes, and script it with --json, cron and jq, even with Procowl closed.
Updated 6 min read
On this page
This page shows how to install the procowl command-line tool (the procowl CLI), what each command does, how to write times for history, what the exit codes mean, and how to use it in scripts. The command works with Procowl closed and uses the same sampling code as the app.
Install the procowl command
The tool ships inside the app at Procowl.app/Contents/Helpers/procowl. Installing it creates a symlink to that file in a folder on your shell's path.
- Open Procowl and choose Settings… (⌘, which is Command-Comma).
- Click General.
- Under Command-Line Tool, click Install….
- If
/usr/local/binisn't writable, Procowl shows the Install the procowl Command alert. Pick a location:- Install in /usr/local/bin… asks for an administrator password.
- Install in ~/.local/bin needs no password, but that folder must be on your shell's
PATH.
Once installed, Command-Line Tool shows the installed path. To confirm the shell finds it, open Terminal and run:
procowl --versionThis prints the tool's version. If you get command not found, see Troubleshooting.
Add ~/.local/bin to your PATH
zsh is the default shell on current macOS. This command adds ~/.local/bin to your path for new Terminal windows:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrcOpen a new Terminal window afterwards. To undo it, open ~/.zshrc in a text editor and delete that line.
Commands
This is the tool's help text, exactly as procowl --help prints it:
Usage: procowl <command> [options] [--json]
status Health sentence and the main readings
top [cpu|memory|disk] [N] Busiest apps (helpers grouped). --processes for single processes
port <number> Who is listening on a port
ports Every listening port of yours. --udp adds UDP sockets
projects Dev servers grouped by project folder
inspect <pid|name> Details of one process (secrets in the command line hidden)
history --at <time> What the Mac was doing at a moment (from Procowl's history)
history --from <time> [--to <time>] Summary and busiest apps over a range
check Alert rules and health. Exit 0 calm, 1 attention, 2 trouble
stop <pid> [--force] [--yes] Quit a process (asks first; protected processes refused)
Options: --json, -h/--help (procowl help exit-codes), --version
Times: 14:02, 2:02pm, yesterday 14:02, 2026-11-11T14:02, -30m, 2h ago, now.The help text leaves out these details:
top: N must be between 1 and 100. Helper processes count toward their app unless you add--processes.portandports: these cover your own processes' sockets. System services owned by root don't appear.check: compares your enabled CPU and disk-write alert rules with the current values, respects apps you've told Procowl never to alert about, and adds the health level. One sample can't show how long something has lasted, so rule durations aren't judged. Memory-growth rules are listed undernotChecked.stop: asks[y/N]when run in a terminal. With no terminal attached (a script or cron job), it refuses unless you pass--yes. Protected processes are always refused.
What the CLI can't see
The CLI runs without elevated privileges and never uses the Enhanced Access helper, even if you installed the helper in the app. It can't read CPU, memory or disk figures for other users' and root processes. Output is always in English, whatever language Procowl uses.
Write times for history
history reads the history Procowl records in the app ("What slowed my Mac?"). These forms work:
| Form | Example |
|---|---|
| Time of day, 24-hour | 14:02 |
| Time of day, 12-hour | 2:02pm |
| Yesterday | yesterday 14:02 |
| Full date and time | 2026-11-11T14:02 |
| Relative | -30m, -2h, 2h ago |
| Current moment | now |
Put times that contain a space in quotes:
procowl history --at "yesterday 14:02"
procowl history --from -2h
procowl history --from "yesterday 9:30" --to "yesterday 12:00"The first command shows what the Mac was doing at one moment. The other two summarize a range and list its busiest apps.
History only covers time when Procowl was running with Record history ("What slowed my Mac?") turned on in Settings ▸ History. The CLI doesn't record anything itself. If nothing matches the time you give, for example because the Mac was asleep or Procowl was quit, history exits with code 1.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success. For check: all calm |
| 1 | check: needs attention. port, inspect, history: nothing matched |
| 2 | check: trouble |
| 64 | Usage error |
| 69 | stop was refused, declined or failed |
| 77 | Locked: open Procowl to activate a license |
Run procowl help exit-codes to print them in Terminal.
Use the procowl CLI in scripts
Every command accepts --json, which gives scripts structured output instead of text. The examples below work with Procowl closed.
Read JSON with jq
jq is a separate command-line JSON tool. If jq isn't on your Mac, you can install it with Homebrew (brew install jq).
procowl status --json | jq .This pretty-prints the full output, so you can see which fields exist before you write a filter. The same works for any command, for example procowl check --json | jq . to see the rules check lists as not checked.
Test a port before starting a server
port exits 0 when something of yours is listening and 1 when nothing is:
procowl port 3000 > /dev/null
case $? in
0) echo "Port 3000 is already in use" ;;
1) echo "Port 3000 is free" ;;
*) echo "procowl couldn't check the port" ;;
esacThe script checks for each code separately because port needs a license pass. A locked tool returns 77, and a plain if would treat that as "port free".
Run procowl check on a schedule with cron
cron runs commands on a schedule with a minimal PATH, so use the full path to the tool (/usr/local/bin/procowl or $HOME/.local/bin/procowl).
- In Terminal, run
crontab -e. - Add this line, then save and close the editor:
*/10 * * * * /usr/local/bin/procowl check > /dev/null 2>&1; s=$?; [ "$s" -ne 0 ] && echo "$(date) check exit $s" >> "$HOME/procowl-check.log"Every 10 minutes this runs check. If the exit code isn't 0, it appends a dated line to ~/procowl-check.log. That covers attention (1), trouble (2) and errors such as a locked license (77). cron jobs don't run while the Mac is asleep. To undo it, run crontab -e again and delete the line.
check judges one sample, not durations. For alerts that wait until a condition has lasted, turn on the rules in Settings ▸ Alerts in the app.
Stop a process from a script
procowl stop 4242 --yesThis quits PID 4242 without the [y/N] prompt. Add --force to force quit instead. A refusal or failure returns 69.
Which commands need a license
- Always free:
status,top,helpand--version. - Need a pass: every other command. While Procowl is licensed or in its trial, the app writes a pass file to
~/Library/Application Support/Procowl/cli-access.json. The pass is valid for 30 days, or for the days left in your trial. Procowl deletes the pass when the license locks.
If a command returns exit code 77, open Procowl. A licensed app writes the pass again. If you run CLI commands from cron and rarely open the app, open it every so often so the pass doesn't run out.
Uninstall the command
- Open Settings… ▸ General.
- Under Command-Line Tool, click Uninstall.
This removes only what Procowl created. Also remove any cron lines that call procowl.
If you deleted Procowl before uninstalling the command, the symlink is left behind and points nowhere. First check that the file is a symlink:
ls -l /usr/local/bin/procowlThe output should start with l and show an arrow (->) pointing into Procowl.app. If it does, remove it. This deletes the file at that path:
sudo rm /usr/local/bin/procowlIf you installed in your home folder, use rm ~/.local/bin/procowl instead (no sudo).
Troubleshooting
| Problem or message | Fix |
|---|---|
command not found: procowl | You installed in ~/.local/bin and it isn't on your PATH. Add it (see above) or reinstall in /usr/local/bin. |
| "The command-line tool is missing from this copy of Procowl. Download Procowl again." | Download Procowl again from macsuite.app and reinstall the command. |
| "Another program already uses /usr/local/bin/procowl. Procowl can install the command in ~/.local/bin instead." | Choose Install in ~/.local/bin, or remove the other file yourself if you know you don't need it. |
| "Another file named procowl is already in ~/.local/bin." | Rename or remove that file, or install in /usr/local/bin. |
| "Couldn't change /usr/local/bin." | Try again and enter an administrator password, or install in ~/.local/bin. |
| Exit code 77 | The license pass is missing or expired. Open Procowl and activate a license, or check whether your trial has ended. |
stop refuses in a script | It needs a terminal to ask [y/N]. Add --yes. |
"Couldn't read the time "<x>". Try 14:02, yesterday 9:30 or -2h." | Use one of the time forms above, and quote times that contain a space. |
| "--from must be before --to." | Swap the two times. |
"Which port? Try procowl port 3000." / "<x> isn't a port number (1–65535)." | Give a port number from 1 to 65535. |
| "N must be between 1 and 100." | Use a count from 1 to 100 with top. |
history returns nothing | The moment falls in a gap, or history is off. Check Settings ▸ History. |
| Other users' or system processes show no figures | The CLI is unprivileged and never uses the Enhanced Access helper. Use the app with Enhanced Access for those. |