Getting up and running with OpenNI and NITE on a Mac

I’m not a c++ developer, but I recently dug into the OpenNI and PrimeSense NITE samples with the ultimate goal of bridging output from the Kinect to Flash. In the end, I found AS3OpenNI and for the time being, don’t need to do any additional work in c++, but I found the experience helpful none-the-less. Following the jump, I detail the components and steps for getting an Xcode project set up. 


  • OpenNI is a framework for natural interfaces.
  • PrimeSense is a sensor maker.
  • PrimeSense NITE is a module for OpenNI. It focuses on seeing hand movement and gestures.
  • PrimeSense Sensor (drivers for PrimeSense (but not Kinect?)).
  • SensorKinect (drivers for Kinect).

I installed everything per this article from Kinecthesis. Before that, I tried to build the latest unstable builds of OpenNI and Sensor, but was not able to make the OpenNI project following the provided instructions and the Sensor drivers did not work with the OpenNI build mentioned in the Kinecthesis article. So, the simplest thing to do is follow the complete set of instructions provided in that article.

Xcode project setup

If you are unfamiliar with Xcode, you should be able to compile the samples provided in the OpenNI and NITE repositories by completing the following:

  1. Copy all files from the Samples/SampleName directory into your Xcode project.
  2. Point the project to the Header files:
    1. Project > Edit Project Settings
    2. Scroll to Search Paths > Header Search Paths
    3. Recursively add /usr/include/ni
    4. Recursively add /usr/include/nite
  3. Point the project to the necissary Libraries:
    1. Project > Edit Project Settings
    2. Scroll to Linking > Other Linker Flags
    3. Add /usr/lib/libnimCodecs.dylib, /usr/lib/libnimMockNodes.dylib, /usr/lib/libnimRecorder.dylib, /usr/lib/libOpenNI.dylib, /usr/lib/libXnVFeatures.dylib, /usr/lib/libXnVHandGenerator.dylib
  4. Set project to 64-bit only. Since I am only interested in 64 bit right now and I only linked the 64 bit libraries above and I set the project away from the default (universal).
    1. Project > Edit Project Settings
    2. Scroll to Architectures > Architectures
    3. Change to 64-bit Intel
  5. Point the project to additional needed frameworks:
    1. Right click on project > Add > Existing Frameworks…
    2. Select OpenGL.framework
    3. Click add
    4. Right click on project > Add > Existing Frameworks…
    5. Click Add Other…
    6. Add /System/Library/Frameworks/GLUT.framework

That should do the trick. Below is a screen shot of my test.

13 Replies to “Getting up and running with OpenNI and NITE on a Mac”

  1. Hi Dave, Since writing this, I’ve not been working in XCode using these libraries. I’ve been using the ASOpenNI project for all my Kinect work. I found it much easier to work in Flash than in XCode. Sorry I can’t help with updated instructions.

  2. I don’t blame you. But do you recall: when starting xcode, do you choose ‘Mac OS X’ then Application, then Command Line Tool? Then which ‘type’ like C/C++ std++ Core Data or what?I copied the entire Samples folder, but that has many individual programs within it, should I have only chosen one? Should those libraries be separated by commas, or strings with enclosing quotes, space-separated?(I’m now trying this on an older machine in hopes I can follow these instructions, then port it to xcode 4 if it will update the project for me.)

  3. Yes, I believe it was a command line tool project set to c++.I only copied one sample per project (you should be able to see the file structure in the screenshot above if you click it).The libraries should be added one at a time into a xCode dialog that supports that (click the + button for each library).

  4. Just found another answer, for anyone else going down this road: “Recursively add /usr/include/ni” means put that in the Header Search Path field, double-click it, and it should pop up a dialog with ‘recursive’ as an option. It results in putting /** at the end of the string. So maybe you can just include that rather than double-clicking.

  5. Thanks. Here’s another “Right click on project > Add > Existing Frameworks…” means in the main project window, under the Groups and Files root of the tree on the left, is your project’s name. Right click THAT, and that gets you to that submenu.

  6. Hi , i’m trying this in xcode4 too and i’m trying to compile the players demo from NITE. I’ve done everything described in your post and the comments. The only thing that i did differently was adding the frameworks , i did this by going into the “Build Phases” tab and there under “Link Binary With Libraries” i added the 2 frameworks. But unfortunately this isn’t working when i compile i get the error “Unknown type name ‘EGLDisplay'” when this is done ==> static EGLDisplay display = EGL_NO_DISPLAY; So does anyone have an idea what i forgot or didn’t do ?

  7. I have done the steps below but still got errorsclang: error: no such file or directory: ‘/usr/lib/libnimCodecs.dylib,’clang: error: no such file or directory: ‘/usr/lib/libnimMockNodes.dylib,’clang: error: no such file or directory: ‘/usr/lib/libnimRecorder.dylib,’clang: error: no such file or directory: ‘/usr/lib/libOpenNI.dylib,’clang: error: no such file or directory: ‘/usr/lib/libXnVFeatures.dylib,’clang: error: no such file or directory: ‘/usr/lib/libXnVHandGenerator.dylib’Command /Developer/usr/bin/clang++ failed with exit code 1

  8. As an update for those using Xcode 4 — the settings that David was referencing in this post are available by double clicking the project file in the Groups and Files section of the Xcode IDE. Make sure you have the project selected when the resulting modal window opens and search for Other Linker Flags and User Header Search Paths. You also have to make sure that you have Always Search User Header Search Paths set to Yes. Also note that since the time of the writing of this post, OpenNI has released new binaries for the Mac, changing the name of XnVFeatures.dylib to XnVFeatures_1_5_2.dylib and XnVHandGenerator.dylib to XnVHandGenerator_1_5_2.dylib.

  9. I’ve tried all that you describe above and have trouble with GL/gl.h. It can’t be localized by xcode. I have copied all the contents of NiViewer into project dir. The folder GL is there. But the framework OpenGL.framework is also there. So maybe xcode don’t know which to use?

  10. Undefined symbols for architecture i386:
    “HandViewer::CreateInstance(xn::Context&)”, referenced from:
    _main in main.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    do you have any idea about this error message?

  11. slinzex, seungjae, I apologize, but I’m not currently working with the NITE libraries and don’t know how they have changed since posting the article above. The best suggestion I can make is to look for a more recent article on installing the libraries and using them with xCode. If the problem is with the libraries themselves, this simplified installation may help you ( I recently ran it without any trouble. I was not working with xCode at the time though, so I don’t know if it will be helpful for you. Good Luck.

Leave a Reply to Dave Cancel reply

Your email address will not be published. Required fields are marked *