i had problems with path to the installed speedtest-cli, fixed with replacing all the path-estimation part.
steps to follow:
1. install speedtest-cli with homebrew (as shown in instruction to this script)
2. in terminal enter: `which speedtest-cli` (without quotes). The output is the path to where your homebrew installed the cli-tool.
3. copy the output and paste in script before the part with grep (don't remove the pipe |, it chains the commands in terminal, so you need it).
my shortened script looks like this:
/opt/homebrew/bin/speedtest-cli | grep "Download\|Upload"