Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make xcode play a sound when you have a compile error

Tags:

xcode

I came across a Terminal one-liner for Xcode 3 that made it play the Inception "BWAAAAHNN" sound every time I tried to compile and hit an error. It worked great as a mistake deterrent, because nobody wants to be startled by that sound EVER.

Anybody know how this was done? Would it still work in Xcode 4?

Edit: thanks to Justin's hint (Preferences > Behaviors > Build Fails > Play Sound) I worked out this:

curl http://www.freesound.org/data/previews/73/73581_634166-lq.mp3 -o /Developer/Extras/trombone.mp3
defaults write com.apple.dt.Xcode "Xcode.AlertEvents.4_1" -dict-add "Xcode.AlertEvent.BuildFails" '<dict><key>Xcode.Alert.Sound</key><dict><key>enabled</key><true/><key>soundPath</key><string>/Developer/Extras/trombone.mp3</string></dict></dict>'
defaults write com.apple.dt.Xcode "Xcode.AlertEvents" -dict-add "Xcode.AlertEvent.BuildFails" '<dict><key>Xcode.Alert.Sound</key><dict><key>enabled</key><true/><key>soundPath</key><string>/Developer/Extras/trombone.mp3</string></dict></dict>'

It's a little more than 1 line, though I'm not sure if that third line is needed (Xcode seems to keep two versions of behaviour settings?). Also, I picked a different sound this time. :)

like image 634
Kenny Winker Avatar asked Jan 07 '12 04:01

Kenny Winker


1 Answers

In Xcode 4, they are Behaviors.

Preferences > Behaviors > Build Fails > Play Sound

or Build Generates New issues

As far as irritating, a behavior can also speak to you, or open and close your project's views, and more, and you can combine them O_O.

like image 67
justin Avatar answered Nov 13 '22 09:11

justin