What is the easiest way I can create a 'beep' sound from a Ruby program?

Try printing the audible bell character:

print "\a"

For Mac OS X:

system('say "beep"')

Conventional print "\a" didn't always work by some reason for me (MBA, 10.7.4)


For windows, use the win32-sound gem - Adding Sound to Your Ruby Apps.

To install:

gem install win32-sound

Then in Ruby:

require 'win32/sound'
include Win32
...
Sound.beep(100, 500)

For non-windows, looks like this could work: How to make beep sounds?

puts 7.chr