# Tap the repository
brew tap jasonlotito/saw
# Install saw
brew install saw
Or install in one command: brew install jasonlotito/saw/saw
# Download the script
curl -O https://raw.githubusercontent.com/jasonlotito/saw/main/saw
chmod +x saw
# Move to a directory in your PATH
sudo mv saw /usr/local/bin/
brew install fswatch)Unlike watch, saw waits for your command to finish before starting the interval timer.
Control exactly how many times or how long your command runs.
-r 10-m 5mTrigger immediate runs on demand without waiting for the interval.
Automatically run commands when files change using fswatch integration.
# Watch file line count every 2 seconds
saw wc -l contributions.txt
# Custom interval of 5 seconds
saw -n 5 ls -la
# Using environment variable
INT=10 saw git status
# Run exactly 10 times
saw -r 10 echo "hello"
# Run for 30 seconds
saw -m 30s date
# Run for 5 minutes with 10-second intervals
saw -m 5m -n 10 uptime
# Combine limits
saw -r 100 -m 5m ./my-script.sh
# Start saw in signal mode
saw -s npm test &
# Trigger immediate run from another terminal
kill -USR1 $(pgrep -f 'saw.*npm test')
# Combine with file watcher
fswatch -o ./src | xargs -n1 -I{} kill -USR1 $SAW_PID
# Watch src directory and run tests on changes
saw -w ./src npm test
# Watch current directory and rebuild
saw --watch . npm run build
# Watch with custom interval between checks
saw -w ./app -n 10 'make build'
| Feature | saw | watch |
|---|---|---|
| Waits for command to finish | ✓ | ✗ |
| Execution limits (max runs) | ✓ | ✗ |
| Time limits (max time) | ✓ | ✗ |
| Signal triggering (SIGUSR1) | ✓ | ✗ |
| File watching integration | ✓ | ✗ |
| Fixed interval execution | ✗ | ✓ |
| Screen clearing | ✓ | ✓ |
| Highlight differences | ✓ | ✓ |
Key difference: watch runs on a fixed interval regardless of command duration.
saw waits for the command to complete, then waits the interval before running again.