This guide is mainly for users of Gnome 2 (now known as Ubuntu Classic session), since the title bar is included in the upper panel in Unity. I suppose it could work on down-scaled windows in Unity too, but that would just make everything seem awfully confusing.
Install the “gconf-editor” package by using either Synaptic or command line. Run it (this must be done by command line or Alt+F2). Go to Apps > Metacity > General and find the option labled “button layout”. Now place the buttons in whichever order you want to. Here are some examples of how you can make your layout look:
Mac OS X layout:
Alternate layout 1:
Alternate layout 2:
You can place the buttons in whichever order you like. Try experimenting a bit until you find the layout that suits you best. Enjoy!