Homebrew provides distribution and package management for common developer packages. It avoids using ad-hoc, developer-specific set ups and version conflicts.
Almost everything you need to support java development, ruby and node.js is available.
Check the installation with brew doctor.
When I originally installed homebrew I had errors because I use the mac as multiple users (one for work work, one for other work).
Bring brew up to date. This may be need to be repeated from time to time.