Shortcut to toggle Bluetooth in Montery via blueutil shell script executed with AppleScript in BetterTouchTool

I have set the Mission Control key in BetterTouchTool to execute an AppleScript and it worked fine before the update from Mojave to Montery which I just did

do shell script "../"

content of file is


blueutil -p toggle

but can't execute in BetterTouchTool.. it says

Executing file from Terminal works flawless.

Executing another script (do shell script "../") in BetterTouchTool with following content to switch profile in Karabiner also works perfectly



cli='/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli'

name=$("$cli" --show-current-profile-name)
if [ "$name" = $pro0 ]; then
"$cli" --select-profile $pro1
"$cli" --select-profile $pro0

When I try to directly run it as shell script, it says

So my guess is I need to set permission for BetterTouchTool to execute scripts in Terminal, but how? I can't figure. Maybe you have figured from the screenshots, that my BTT version is old :grimacing: v.2.428.. not even know what the most recent version number is... mine does everything I need just fine, but would be willing to upgrade if the shell script option could trigger blueutil.. is this the case?

edit1: Seeing other questions here with mojave tags, I am thinking of switching back to mojave again... -.-

also edit1: thank you so much for this tool, Andreas... using it for a decade now and wouldn't do without!

It is most likely a problem with the permissions of the sh file. Possibly try to make it executable using chmod +x

If you want to use the shell script option in BTT you need to provide a launch path (/bin/sh) a command (-c) and the actual script content "/path/to/blueutil -p toggle" (you need to use the full path)

actually permission of the file wasn't set properly. thank you for that.. now I am at the same point as with the script where it says command not found

the script content is


blueutil -p toggle

therefore I thought I don't need to set the launch path but you are right, but also here: command not found

as little proof that the command exists

Executing a script which simply echo's Hello works just fine.. could it be that since blueutil is a tool installed via brew, I need to set a different path?

you would not call the sh file with the shell script task action. The shell script action would contain the content of that sh file as shell script part. But every executable that is called from within needs to be referenced by it's full path (e.g. /usr/bin/blueutil -p toggle)

If you need to use sh inside the shell script task you also need to use the full path for it (/bin/sh )

By the way, BTT does have an action to toggle Bluetooth On/Off, but I don't know whether it was included in the version you use

1 Like

ah nice. then I will maybe go with that since I was thinking about to buy a lifetime licence anyway. my version does not have the option. but will try to figure the shell thing first. thank you!

ps. I also asked for a feature to trigger the context menu via shortcut years ago.. is this option also available with newer versions? :slight_smile:
would be even more tempting to upgrade then

Which context menu do you want to trigger? Default right-click?

yes, excatly. for the selected file

yea.. I set the path to blueutil and made it work. thank you!

You can use this apple script to right click the selected item in Finder:

tell application "System Events"
	tell process "Finder"
		set _selection to value of attribute "AXFocusedUIElement" --focused element (selected element)
		tell _selection to perform action "AXShowMenu"
	end tell
end tell
1 Like

never thought of doing it with AppleScript myself...