Add Mac OS X support

It almost works, although there still have some problem at the ^N function.