I need to generate musical notes of a given frequency on the command line
Here is a list of the frequencies of notes http://www.phy.mtu.edu/~suits/notefreqs.html
SoX works really good for this purpose and it's available in brew:
$ brew install sox $ play -n synth 3 sin 523.25
You can also save the sound to a file:
$ play -n out.wav synth 3 sin 523.25