How-to Setup and Use Python with OBS on a Mac

j12y

Jayson DeLancey

Posted on October 20, 2023

How-to Setup and Use Python with OBS on a Mac

Open Broadcaster Software (OBS) can be a helpful tool and tailored for different use cases with custom scripts. These can help solve a wide variety of dynamic features such as counters, timers, displaying data fetched by API, scene transitions, audio/video filters, etc. that require custom automation when hosting live streams.

A lot of the information out there about scripting in OBS is not un-surprisingly YouTube videos for Windows users. This is the blog post I wish I had found when I started setting up OBS 30 as a development environment for macOS.

tl;dr: Use ⌘+shift+G and type in the path to /opt/homebrew/Cellar/python@x.y/x.y.z/Frameworks

Configuring Python for OBS on a Mac

On the surface this sounds like it should be simple, but there are a few gotchas that I had to research and took a non-trivial amount of time to find the right answer.

The Python/Lua Scripting docs say:

NOTE: To use Python on Windows or macOS, you must download and install a Python version that matches your OBS architecture. Then, in the scripting dialog, you must set the path to the Python install in the “Python Settings” tab.

There are a few additional details that may be helpful.

Step 1: How-to Find Your Installed Python Location

This can vary from system to system depending on how you've installed Python. In my case, I'm running Python 3.11 that was installed with Homebrew.



> which python3
/opt/homebrew/bin/python3

>


Enter fullscreen mode Exit fullscreen mode

This is not the path that OBS wants however, the path you need is something that might look like this:



/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks


Enter fullscreen mode Exit fullscreen mode

If you input a path to the /bin directory or even the root python@3.11 or go to far into the python@3.11/Frameworks/Python.framework folder you'll be left with Python not currently loaded.

Python not currently loaded

Step 2: How-to Input the Python Path Settings

To configure OBS, you'll need to select the menu Tools -> Scripts and then click on the Python Settings tab:

Select Tools

To input the Python location may depend on how you've configured your system, but typically the /opt folder is not something you will see in your Finder that OBS brings up for selecting the Python Install Path.

The trick here is a keyboard shortcut. Use ⌘+shift+G to pop-open an input window to type in the path.

When you see the message Loaded Python Version along with the version you are ready to roll.

Python Settings for OBS on a Mac

Ready to Script

You are now prepared to run Python scripts you may find written by others or start developing your own.

Here are some you may find as helpful examples in the OBS Forums:
https://obsproject.com/forum/resources/categories/scripts.5/?prefix_id=6&order=rating_weighted&direction=desc

Here are the docs for more on how to write scripts:

More examples of this in this series later.

💖 💪 🙅 🚩
j12y
Jayson DeLancey

Posted on October 20, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related