Installing flua on macOS — Python, pip, VS Code, and the usual bumps

flua needs Python, and Python on a Mac is where most of the confusion lives — several Pythons can exist side by side. This post walks through the install, the upgrade, where things land, and what to do when something does not work. No programming background required.

1. Install Python (with Homebrew)

flua needs Python 3.11 or newer. The cleanest way on macOS is Homebrew. First check whether brew is there:

brew --version          # prints "Homebrew ..." — if not, install from https://brew.sh

Then install Python and check it:

brew install python3    # installs the current Python
python3 --version       # should print Python 3.11 or newer
python3 -m pip --version

The python3 -m pip form matters: it always uses the pip that belongs to python3, even when several Pythons are installed.

2. Install flua

python3 -m pip install fibaro-flua

Test it — flua is now on your PATH:

flua --version

And a real smoke test. Save this as hello.lua:

function QuickApp:onInit()
  print("QuickApp initialized")
  exit(0)
end

and run it:

flua hello.lua

You should see QuickApp initialized in the log. No HC3 needed: without controller credentials flua runs against the emulated controller (force it anytime with flua --api local hello.lua).

3. Upgrade flua — and back down if needed

python3 -m pip install --upgrade fibaro-flua
flua --version          # confirm the new version

If a version turns out to have bugs, pin a known-good one instead of living with it:

python3 -m pip index versions fibaro-flua    # list every version on PyPI
python3 -m pip install fibaro-flua==0.1.17   # pin a known-good version

Same rules as the upgrade: run the command with the Python that owns your flua (head -1 $(which flua) — see troubleshooting below).

4. Where is it installed?

which flua               # e.g. /opt/homebrew/bin/flua (Apple Silicon)
                         # or  /usr/local/bin/flua (Intel)
which -a flua            # every flua on this machine (virtualenvs etc.)
head -1 $(which flua)    # which Python owns this flua

That last line shows the Python your flua runs on — the shebang of the installed command. Handy when upgrades do not seem to stick.

5. VS Code: the launch.json story

Run flua --tool setup in your QA project folder. It writes .vscode/launch.json and .vscode/tasks.json — the F5 run/debug configurations.

6. Troubleshooting

Everything past step 2 — the emulator, the UI viewer, the VS Code debugger — is covered in the tutorial series here on the forum.

flua: https://github.com/jangabrielsson/flua · docs: USAGE.md · pip: https://pypi.org/project/fibaro-flua/