Skip to content

Instantly share code, notes, and snippets.

@portdeveloper
Created December 22, 2025 14:52
Show Gist options
  • Select an option

  • Save portdeveloper/1709172d3e250219c94b7934cf5aab2e to your computer and use it in GitHub Desktop.

Select an option

Save portdeveloper/1709172d3e250219c94b7934cf5aab2e to your computer and use it in GitHub Desktop.
Setup sound notifications for Claude Code on macOS
#!/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