oops is in beta. Report any issues on GitHub.

Terminal undo on Mac

May 2026

macOS has great undo in apps, but Terminal is different. Cmd+Z does not undo shell commands, and Ctrl+Z suspends a foreground process instead of restoring files.

Why Trash does not save rm

Dragging a file to Trash is a Finder action. Running rm in Terminal removes the file directly. That is why a mistaken rm often does not appear in the Trash.

Adding undo to zsh, bash, and fish

oops supports macOS shells by installing a shell hook. The hook watches commands before they run. Safe commands pass through; destructive commands get a local backup first.

curl -fsSL oops-cli.com/install.sh | bash # then open a new terminal tab oops tutorial

What it protects

On Mac, oops catches rm, rm -rf, mv overwrites, sed -i, git reset --hard, git clean -fd, redirects, and cleanup commands. Backups live under ~/.oops/trash/ and auto-clean after the configured retention window.

Good Mac workflow

Use Time Machine or another backup system for long-term recovery. Use oops for the short window after a terminal mistake, when you want the deleted file back immediately.