Apple has a sample GLEssentials project code that shows how to do this (note that this is Mac OS X and iOS sample project code).
Essentially, you need to subclass NSOpenGLView (the NSGLView class in the sample code) and implement the awakeFromNib method using the following:
- (void) awakeFromNib { NSOpenGLPixelFormatAttribute attrs[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFADepthSize, 24,
Also remember that if you use any OpenGL API calls that have been removed from the 3.2 API, your application will crash. Here is a PDF of specification 3.2 so you can see the changes.
source share