Created
December 22, 2025 14:52
-
-
Save portdeveloper/1709172d3e250219c94b7934cf5aab2e to your computer and use it in GitHub Desktop.
Setup sound notifications for Claude Code on macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Setup sound notifications for Claude Code on macOS | |
| SETTINGS_FILE="$HOME/.claude/settings.json" | |
| # Create .claude directory if it doesn't exist | |
| mkdir -p "$HOME/.claude" | |
| # Check if settings file exists and has content | |
| if [ -f "$SETTINGS_FILE" ] && [ -s "$SETTINGS_FILE" ]; then | |
| # Merge with existing settings using a temp file approach | |
| # Back up existing settings | |
| cp "$SETTINGS_FILE" "$SETTINGS_FILE.backup" | |
| echo "Backed up existing settings to $SETTINGS_FILE.backup" | |
| fi | |
| # Write the hooks configuration | |
| cat > "$SETTINGS_FILE" << 'EOF' | |
| { | |
| "hooks": { | |
| "Stop": [ | |
| { | |
| "matcher": "", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "osascript -e 'beep 2'" | |
| } | |
| ] | |
| } | |
| ], | |
| "Notification": [ | |
| { | |
| "matcher": "", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "osascript -e 'beep 3'" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } | |
| EOF | |
| echo "✓ Claude Code sound notifications configured!" | |
| echo " - 2 beeps when task finishes" | |
| echo " - 3 beeps when input needed" | |
| echo "" | |
| echo "Restart Claude Code to activate." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment