FEAT: added history support to OS X console

Stéphane Vereni's changes to add history support to the console and the change you suggested re freeing memory allocated to a string.