If you read my previous post here, you will find detailed instructions to install the Cocos2d-x game engine on Linux.
I wanted to do the same kind of tutorial for Mac and Windows but there are already a few very good tutorials on how to do that. Instead of doing one more tutorial, I would like to refer you to some YouTube videos made by Sonar Systems that cover the installation of Cocos2d-x on Mac and Windows.
Watch this video tutorial to set up Cocos2d-x for iOS on Mac
This other tutorial will help you setup Cocos2d-x for Android on MAC
And this other tutorial will show you how to set up Cocos2d-x for Android on Windows.