Messing again in OSS, and after a workstation migration thought this might be useful for the next one. I am basing my post on Rumen Filkov’s post, but commenting and clearing some of the steps which might tricky.
1. Download and unpack OpenNI2 and NiTE2 tar balls. (Make sure you’re getting the x86_64 version whenever possible)
2. Open ‘/etc/launchd.conf’ and set the needed environment variables: ‘setenv OPENNI2_REDIST [path-to-openni2]/Redist‘ and ‘setenv NITE2_REDIST [path-to-nite2]/Redist‘. You might need to create the file from scratch. Then restart your Mac. Use the ‘printenv’ command to verify that the variables are actually set.
3. If needed install libusb 32-bit: ‘brew install –universal libusb‘. At this point, if your sensor is PrimeSense, the OpenNI2-Unity package should work.
4. Kinect only: Install libfreenect: ‘brew install –universal libfreenect‘. This will shortcut on some dependencies.
5. Kinect only: If OpenNI2 still cannot find the Kinect sensor, take the driver’s sources from https://github.com/piedar/OpenNI2-FreenectDriver and build a universal dylib, i.e. for both x64 and i386 architectures. In order to accomplish an universal build just edit the wscript in your OpenNI2-FreenectDriver directory and append the following:
conf.env.append_value(‘CXXFLAGS’, [‘-arch’, ‘i386’])
conf.env.append_value(‘CXXFLAGS’, [‘-arch’, ‘x86_64’])
conf.env.append_value(‘LINKFLAGS’, [‘-arch’, ‘i386’])
conf.env.append_value(‘LINKFLAGS’, [‘-arch’, ‘x86_64’])
6. copy the files bellow to ‘[path-to-openni2]/Redist/OpenNI2/Drivers’ and try again.
libFreenectDriver.1.2.1.dylib
libFreenectDriver.dylib
libFreenectDriver.1.dylib
That’s it ;)