Comment by dep_b

6 years ago

I would love to have it to automate

    sudo killall -STOP -c usbd

Let's see if it works - Automator didn't work too well

Don't use Hammerspoon, but I've managed to create `sudo killall` keybindings with skhd by wrapping AppleScript.

    cmd + shift - 9 : /usr/bin/osascript -e 'do shell script "killall coreaudiod 2>&1" with administrator privileges'

Here's the relevant line from my skhd configuration. This does pop a password prompt, but it works. I imagine you could adapt this to fit Hammerspoon.

Just curious, why do you need to do this?

  • Possibly for the bug/feature that causes an iPhone connected by USB to connect and disconnect repeatedly on a ~2sec cycle, The bug leads to endless modals appearing on the iPhone, and sometimes iTunes opening with each reconnection.

    • That's right! Drove me nuts when I didn't know I could do this since the problem would go away for a while when I bought a new cable.

      1 reply →