If you’re reading this, then there’s a good chance you’re pretty creative, and are interested in experimenting with the Microsoft Xbox Kinect on Mac OS X 10.8 (Mountain Lion). Well luckily you’re in the right place. I’ve done all the hard trial and error legwork, and will hopefully be able to provide you with a simple rundown of how to get the Kinect up and running on your mac. I’ll follow this post up with a ‘part two’ where we jump into some experiments and test out some of the device’s capabilities.
If you have any questions, feel free to pop them in the comments section and I’ll do my best to research an answer.
So before we get going, it’s worth explaining exactly what the Kinect is and does. According to the good chaps at Wikipedia, the Microsoft Kinect “is a motion-sensing input device… that is able to track the movements of objects and people in three dimensions”. Interestingly it’s also listed as the fastest selling consumer electronic device “after selling a total of 8 million units in its first 60 days.”
Step 1: Install Xcode
So if you plan to be a developer on the mac, you can be damned sure that you’ll need to use Xcode at one point or another.
1. Start by downloading Xcode from the Mac App Store. Once installed, open Xcode, and from the menubar, navigate to: Xcode / Open Developer Tool / More Developer Tools…
2. When you click this option, you’ll be taken to the Apple Developer website, and prompted to register or sign in. Once you’re in, you should see the Apple Developer Downloads page.
3. Click the link to download the latest ‘Command Line Tools’ disk image (highlighted in blue in the above screenshot), and then run the installer. In future, you can then update this tool from your preferences: Xcode / Preferences…
And that my friends is step one complete!
Step 2: Install Additions
Xcode is just the beginning. To make your life a little easier, it’s going to be a great idea to install the following:
- XQuartz: An open source version of the X.org X Window System for Mac.
- CMake: A cross-platform build automation system.
- MacPorts (click the Mountain Lion text link): An easy way to compile, install and upgrade software via the command line (Terminal app).
Once you’re done installing these three apps, you can move on to the next step.
Step 3: Install Dependencies
Okay, so you’ve installed all the major applications, now we move onto the libraries that will help your Kinect interface with Mac OS X.
Libtool: A generic library support tool.
1. To install Libtool, firstly open Terminal on your mac: Applications / Utilities / Terminal.
2. Now type in:
sudo port install libtool
3. Press return, and you’ll be prompted for your OS X admin/user password. Type this in, and click return again. If you mess it up, don’t stress, just push return and you’ll get a second go. When it’s installed, you should see a line of text similar to this:
libtool @2.4.2_3 (active)
Libusb: A usb support tool for applications.
1. You should still have Terminal open. If not, then re-open it again.
2. Now type in:
sudo port install libusb +universal
3. Press return, and enter your password when prompted. If it worked, you will see the text similar to this:
libusb @1.0.9_0+universal (active)
Step 4: Install OpenNI SDK (v18.104.22.168)
Like I stated earlier, you probably don’t yet want to install version two of this software as it will have compatibility issues with your Mac (I learnt this the hard way). OpenNI is the primary framework that will let you interface with your Kinect. It’s made by the guys who originally developed the Microsoft Kinect, and has a bunch of cool middleware libraries and applications to play around with.
1. Create a new folder on your mac called ‘Kinect’. This will help keep things organised.
3. Move the file you just downloaded to your Kinect folder and double click to uncompress and reveal the SDK folder.
At this point, you’re now ready to install the SDK.
4. Open Terminal on your mac: Applications / Utilities / Terminal.
5. Next we need to navigate to the SDK folder using the command line in Terminal. Start by typing in cd, and then drag your SDK folder from the Finder onto the Terminal window. This will automatically enter the path for you, and look similar to this:
6. Press return to commit the action. You’ll know it worked, because your directory should now be listed on the next command line, similar to this:
7. Now you can install the SDK by typing:
8. Press enter, and then submit your password when prompted. If everything worked, you will see the text below, and be cool to move on to the next step.
Installing OpenNI **************************** copying shared libraries...OK copying executables...OK copying include files...OK creating database directory...OK registering module 'libnimMockNodes.dylib'...OK registering module 'libnimCodecs.dylib'...OK registering module 'libnimRecorder.dylib'...OK creating java bindings directory...OK Installing java bindings...OK *** DONE ***
Step 5: Install SensorKinect
This is a module that helps the Kinect specifically interact with the OpenNI framework. You’ll need it for your Kinect to work on your Mac.
1. Visit the SensorKinect project page on GitHub.
2. Click the ‘Zip’ button to download the latest version of the software.
3. Move your newly downloaded file to your Kinect folder, and uncompress to reveal the module folder.
4. Open the folder, and navigate to the MacOSX .tar.bz2 file inside the Bin folder.
5. Double click to decompress this folder.
Once again, you’re now ready to install.
6. Open Terminal on your mac: Applications / Utilities / Terminal.
7. Navigating this one is a little different. Once again, type in cd, and drag the last folder you decompressed to the Terminal window to fill in the filepath. Below is an example (note the Bin folder):
8. Press Return to commit the action.
9. Now install the SDK by typing:
10. Press enter, and then submit your password when prompted. If everything worked, you will see text like so:
Installing PrimeSense Sensor **************************** creating config dir /usr/etc/primesense...OK copying shared libraries...OK copying executables...OK registering module 'libXnDeviceSensorV2KM.dylib' with OpenNI...OK registering module 'libXnDeviceFile.dylib' with OpenNI...OK copying server config file...OK setting uid of server...OK creating server logs dir...OK *** DONE ***
And again, you’re done! Give yourself a pat on the back and move on to the next step.
Step 6: Install NiTE
Okay, time to take a breather. You’re almost there now. The next thing you’ll be installing is ultra awesome NiTE middleware, which is also produced by the same guys behind OpenNI. NiTE uses depth, colour, infrared and audio to track your body or hand and use it as an input device… along with a lot of other cool stuff.
2. Once more, move the newly downloaded file to your Kinect folder and double click to uncompress and reveal the NiTE folder.
And guess what it’s time for now! W00t! Installation time.
3. Open Terminal on your mac: Applications / Utilities / Terminal.
4. Now navigate to the NiTE folder using the command line in Terminal. Start by typing in cd, and then drag your NiTE folder from the Finder onto the Terminal window. This will automatically enter the path for you, and look something like this:
5. Press Return to commit the action.
6. Now we can install the package by typing in:
7. Press Return to commit, and once again enter your password when prompted. If everything was a success, you should see the text:
Installing NITE *************** Copying shared libraries... OK Copying includes... OK Installing java bindings... OK Installing module 'Features_1_3_0'... ls: Features_1_3_0/Bin/lib*dylib: No such file or directory Installing module 'Features_1_3_1'... ls: Features_1_3_1/Bin/lib*dylib: No such file or directory Installing module 'Features_1_4_1'... ls: Features_1_4_1/Bin/lib*dylib: No such file or directory Installing module 'Features_1_4_2'... ls: Features_1_4_2/Bin/lib*dylib: No such file or directory Installing module 'Features_1_5_2'... Registering module 'libXnVFeatures_1_5_2.dylib'... OK Copying XnVSceneServer... OK Installing module 'Features_1_5_2' ls: Hands_1_3_0/Bin/lib*dylib: No such file or directory Installing module 'Features_1_5_2' ls: Hands_1_3_1/Bin/lib*dylib: No such file or directory Installing module 'Features_1_5_2' ls: Hands_1_4_1/Bin/lib*dylib: No such file or directory Installing module 'Features_1_5_2' ls: Hands_1_4_2/Bin/lib*dylib: No such file or directory Installing module 'Features_1_5_2' registering module 'libXnVHandGenerator_1_5_2.dylib'...OK Adding license.. OK *** DONE***
Woo! Your journey is just about complete! Let’s test this out and see if it works.
Step 7: Test Your Kinect Using the Sample Files
This is where it gets interesting. If you’ve gotten to this step without any issues, then nice work! To test what we’ve completed, there are a few final steps…
1. Copy the sample xml files from NiTE / Data over to your SensorKinect / Data folder like so:
2. Open Terminal app again: Applications / Utilities / Terminal.
3. Navigate to the NiTE / Samples / Bin / x64-Release folder using the command line in Terminal. Start by typing in cd, and then drag the x64-Release folder from the Finder onto the Terminal window. Again, this enters the path for you, looking something like this:
4. Hit Return to commit the action.
5. Now you can open the first tech demo called “PointViewer” by typing in:
6. Make sure you have your Kinect connected, and then hit Return. PointViewer should open in a new screen with a visual demonstration of the tracking abilities our newly installed frameworks can deliver. Wave your right hand around in the air and watch it track your motion.
7. Fun huh?! You can also try out the ‘Players’ demo too by typing in:
8. Hit Return and you’ll get the demo screen again, but this time it’ll recognise your body shape, highlighting it in blue.
And that my friends completes this tutorial. I hope you were able to follow along, and made it through all the steps. If you have any questions, please feel free to ask them in the comments section. Make sure you subscribe to this blog to stay up to date with any future creative tech demos and tutorials!