How do I install libgit2 on OSX Lion?
I coul not install pygit2 using pip. However, it worked fine using the latest version available on Github:

$ git clone git://github.com/libgit2/pygit2.git
$ cd pygit2
$ python setup.py install


The problem here I think is that you're trying to use a two month old pygit2 release with the cutting edge version of libgit2. If using pip is an absolute necessity, you should try installing an older version of libgit2 too (like this one).

You only have to use the -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" flag if you're targeting "old" Macs without 64 bits capable processors (before Core 2 x, with Snow Leopard or older).

You should also run

$ cmake --build . --target install


after your

$ cmake --build .


command. Without this, libgit2 headers (*.h) and libraries (*.dylib) will not be installed in your /usr/local/{include,lib} directories and will not be available to others softwares (hence your compilations errors).