Try to run shell script command

please i just install this:

with homebrew with mac terminal

OK, when i run this:
SwitchAudioSource -s "GUY’s AirPods Max"
in my terminal
it work like a magic and it succeeds to change the output sound to : "GUY’s AirPods Max"

but when i try to make keyboard maestro macro to run this commend
and make hot key for the macro
i cannot succeed to do that

i used the Execute Shell Script (as you can see in the screenshot)
but it do not work

See the "Path in Shell Scripts" section of the "Execute a Shell Script" page of the KM Wiki for an explanation and a choice of solutions – the easiest of which is just to enter the full path.

KM doesn't know where SwitchAudioSource is because it is not where KM knows to look (/usr/bin/, /bin/, /usr/sbin/ and /sbin/).

In the case of a binary installed by Homebrew, you will probably find it in /opt/homebrew/bin/. Enter which SwitchAudioSource in the terminal to check that. Assuming it is there, you could replace:

SwitchAudioSource -s "GUY’s AirPods Max"

with:

/opt/homebrew/bin/SwitchAudioSource -s "GUY’s AirPods Max"

As @kevinb explains, the Execute Shell Script action provides a vanilla shell script, without $PATH or any other environment variables pre-declared.

It's not connected to the macOS Terminal.app.

Additionally, you can set an ENV_PATH variable that KM will use to run shell scripts with the default (and any other paths you have added) paths to your executables. I prefer this method because I don’t have to worry about supplying a path in every shell script action. If you need help setting the ENV_PATH variable, see this topic:

Create a PATH Environment Variable for Keyboard Maestro and Add /usr/local/bin to the Default Path