How to Install Kivy on MacOS in 2022

Kivy is a GUI development library for Python that allows developers to code an application once and have it run on all different types of devices.

Last night, I decided to learn about it because I was curious. What I wasn’t prepared for was the fact that just trying to install it on a MacOS would take me over an hour.

So, in order to make sure that any of you interested in installing Kivy don’t make the same mistakes as me, here is a comprehensive tutorial on how to install Kivy in 2022 (using the terminal)!

1. Installing Python

Just to be clear, Kivy seems much easier to install on a Windows operating system. But try and follow the same instructions on a MacOS, and things get complicated. Especially since Kivy has been updated recently, and there don’t seem to be any proper tutorials out there.

However, I would say the easiest first step is installing Python. You need to have Python 3.9 running (you can also have certain older versions of Python, but as of the time that I am writing this post, Kivy does not officially support Python 3.10). To check if you have it installed already, open your MacOS terminal and type in python3.

If the command python3 doesn’t work (or if you have the wrong version installed), go to this page to download the correct Python version.

2. Installing pip

For your next step, I would recommend installing pip.

To do so, run these commands inside of your terminal:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py

 

3. Installing Kivy

Great job! Now all that’s left is to install Kivy itself. However, do not use the code given on the actual website. Whenever I tried this, I would get numerous errors. Instead, I would recommend copying this line of code into the terminal:

python3 -m pip install kivy kivy_examples

 

4. (Optional?) Installing Homebrew and Source Dependencies

If the above worked, then congrats! You have successfully installed Kivy. But if not, then there is one more thing I would recommend trying.

Try installing Homebrew from their website using this link. Next, put the following command into your terminal:

brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer

After you’ve done this, try step 3 again and see if it works.

I hope this helps! And if you have any questions, please let me know. Have fun coding!

Here is a link to Kivy’s website if you want more information on the installation process: https://kivy.org/doc/stable/gettingstarted/installation.html

Leave a Reply

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