Kinect on MacOS X with Homebrew

This is with XCode 4.6.2 on Mac OS X 10.8

If you use our favorite package manager getting up and running with libfreenect  is almost straightforward :).

1) Be sure homebrew is installed see http://mxcl.github.io/homebrew/

2) Go to

cd /usr/local/Library/Formula

3) Get the formulas

curl --insecure -O "https://raw.github.com/OpenKinect/libfreenect/master/platform/osx/homebrew/libfreenect.rb"
curl --insecure -O "https://raw.github.com/OpenKinect/libfreenect/master/platform/osx/homebrew/libusb-freenect.rb"

3) Try installing it with

brew install libfreenect

If this works you are fine and you can say thank you to the Documentation or several fellow posters out there.

If however it fails like in my case with an error like You should use the ‘AC_CONFIG_HEADERS’ macro instead.

Do the following

4) Edit the formula libusb-freenect.rb with your favorite editor in my case

subl libusb-freenect.rb

then update two lines in the install method thanks to https://github.com/mxcl/homebrew/issues/17266
so it should look like this.

require 'formula'

class LibusbFreenect <Formula
  url 'http://git.libusb.org/?p=libusb.git;a=snapshot;h=7da756e09fd97efad2b35b5cee0e2b2550aac2cb;sf=tgz;js=1'
  homepage 'http://www.libusb.org/'
  version "7da756e09fd97efad2b3"
  md5 ''

  depends_on 'libtool'
  depends_on 'automake'

  def patches
    # patches libusb to work with libfreenect
    "https://github.com/OpenKinect/libfreenect/raw/master/platform/osx/libusb-osx-kinect.diff"
  end

  def install
    inreplace 'configure.ac', 'AM_CONFIG_HEADER', 'AC_CONFIG_HEADERS'
    ENV.universal_binary
    system "./autogen.sh"
    system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking", "LDFLAGS=-framework IOKit -framework CoreFoundation"
    system "make install"
  end
end

After that run brew install  again and you should be up and running check with glview .

Hope that helps

J.

2 responses to “Kinect on MacOS X with Homebrew”

  1. // step 3)
    overflow: auto;

  2. Awesome!
    Thanks for this post.

    Now, I can build gesture + voice based controls in apps (electron based)
    case 1: show product barcode to Kinect and say “add” or “plus” or “bill”
    case 2: show and say “minus” or “remove”
    case 3: use hand as a mouse (nice and fun engagement for a customer visiting a store. virtually picking items or scrolling through its color options)

    Many more use cases. 🙂

Leave a Reply

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