The answer above was mostly correct, just needed some tweaking for the different parameters in Mac OSX.
ps -A | grep [f]irefox | awk '{print $1}'
You can use the pgrep command like in the following example
$ pgrep Keychain\ Access44186
You can install pidof with Homebrew:
pidof
brew install pidofpidof <process_name>