Read the how to install Node.js and Haxe here.
Once you have installed Haxe you will automatically installed
The same goes for Node.js, you will have automatically installed
You should read more about Grunt here, it will explain the workings of Grunt. But the quick-and-dirty install is the line below in your terminal.
npm install -g grunt-cli