Scripting the sniffer built into Wireless Diagnostics
Following this answer, I'd suggest starting by symlinking the airport tool, which is the backend behind the Wireless Diagnostic tool:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport


and using it to sniff e.g. on channel 1 on your connection en1 (see ifconfig to figure out which network interface is the wireless one) via:

sudo airport en1 sniff 1


which will create a uniquely named .cap file in /tmp/. Use ctrl+c to end the sniffing. (Note that /tmp/ will be cleaned on reboot!)

Note that you can also use tcpdump directly for sniffing, without disassociating from wireless networks by:

sudo /usr/sbin/tcpdump -nei en1 -s 0 -w /tmp/scan.pcap