Replacing rm command with trash in Claude Code
Read OriginalThis article explains a practical workaround for preventing accidental permanent file deletions when using Claude Code, which has access to bash tools. The author describes adding 'Bash(rm:*)' to a deny list in Claude Code's global settings to block rm commands, then configuring Claude to use the 'trash' CLI tool instead. The trash command moves files to macOS Finder trash instead of permanently deleting them. Instructions include installing trash via Homebrew, updating the CLAUDE.md file with a rule to always use trash, and an example from a real session migrating from ESLint to OxLint. This approach allows safe file deletion with recovery options.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
No top articles yet