B2G build prerequisites | Mozilla | MDN
Then you need to open a terminal and run this command in the terminal; this will pull and run a bootstrap script that makes sure you have all prerequisites met.
curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash