Installing kivy on Mac OSX 10.6 with brew

Posted by acidjunk on August 28, 2013

We are doing more and more cool kivy stuff so it’s time to get the designers happy and let it run from src on their workstations for easy access to the graphics and .kv files.

Step 1: Remove previous homebrew stuff and get a new one

Because I had an already F#ck up OS X with brew installed python, PyQt etc I decided to start over almost clean. I followed the instruction from: here to remove the older installed packages, although there could be better places; like the home brew FAQ it seems.

Please skip this if you have a decent and recent homebrew, it will remove all installed packages

cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

I also reverted the PATH in my .profile back to normal (e.g. /usr/local/bin is loaded after the other bin paths).

The reinstall or install brew with:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Step2: get a decent python

brew install python

I had some left overs from previous Cellar: linking failed, this is how I solved it.

brew link --overwrite python

Then I changed back the paths in my ~/.profile so /usr/local/bin preceeds the other bin paths in the PATH environment variabele: PATH=/usr/local/bin:$PATH

I restarted my terminal to verify that running python returns something like this:

Python 2.7.5 (default, Aug 23 2013, 03:07:24) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Step 3: install kivy based on the homebrew python

brew install mercurial

I had some left overs from previous Cellar: linking failed, this is how I solved it.

brew link --overwrite mercurial

Install SDL and other libs needed for pygame etc:

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
pip install cython
pip install pil
pip install hg+http://bitbucket.org/pygame/pygame
pip install kivy

I tested it with the kivy examples and they run really nice. Resizing of screen works, all examples seem to start ok.

Kivy examples 1.7.2 running on Mac OSX 10.6