def METHOD_NAME(command: str | None, cwd: Path, env: dict[str, str]) -> None:
    log.debug("using MacOS terminal.app")
    if not command:
        subprocess.Popen(["open", "-a", "Terminal", str(cwd)], env=env)
        return
    assert shutil.which("bash") is not None
    with tempfile.NamedTemporaryFile("w", delete=False, prefix="porcupine-run-") as file:
        print("#!/usr/bin/env bash", file=file)
        print("rm", shlex.quote(file.name), file=file)  # runs even if command is interrupted
        print(
            shlex.quote(str(run_script)),
            "--dont-wait",
            shlex.quote(str(cwd)),
            shlex.quote(command),
            file=file,
        )
    os.chmod(file.name, 0o755)
    subprocess.Popen(["open", "-a", "Terminal.app", file.name], env=env)
    # the terminal might be still opening when we get here, that's why
    # the file deletes itself
    # right now the file removes itself before it runs the actual command so
    # it's removed even if the command is interrupted