skhd icon indicating copy to clipboard operation
skhd copied to clipboard

brew services restart fails with skhd

Open andynameistaken opened this issue 3 years ago • 11 comments

❯ brew services restart --all
Stopping `skhd`... (might take a while)
==> Successfully stopped `skhd` (label: homebrew.mxcl.skhd)
==> Successfully started `skhd` (label: homebrew.mxcl.skhd)
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/andy/Library/LaunchAgents/homebrew.mxcl.skhd.plist` exited with 5.

andynameistaken avatar Jun 10 '21 11:06 andynameistaken

This is likely to be an issue with your machine. Try to run the failed underlying launchctl command directly to possibly get a better error message.

dominiklohmann avatar Jun 10 '21 13:06 dominiklohmann

andy@Andrzejs-MacBook-Pro ~ % launchctl load /Users/andy/Library/LaunchAgents/homebrew.mxcl.skhd.plist
Load failed: 5: Input/output error

It is unlikely that this is problem with my machine, I reinstalled system and issue still occured.

andynameistaken avatar Jun 10 '21 22:06 andynameistaken

FYI, macOS 11.4, skhd 0.0.6. If you are on the same version of the system could you run brew services restart --all?

andynameistaken avatar Jun 11 '21 18:06 andynameistaken

I'm having the same issue after updating to macOS 11.5.2 today, not with skhd but with yabai

$ brew services start yabai
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/hangyi/Library/LaunchAgents/homebrew.mxcl.yabai.plist` exited with 5.

patricorgi avatar Aug 13 '21 02:08 patricorgi

I had the same issue and finally I found the solution for it,

Step 1

Enable this plist

launchctl enable service-target

Step 2

Run this plist now

launchctl kickstart service-target

Step 3

So, for the file at ~/Library/LaunchAgents/setUserKeyMapping.plist I ran:

launchctl enable gui/$UID/setUserKeyMapping

Step 4

launchctl kickstart gui/$UID/setUserKeyMapping

If you pass -kp to the kickstart action, it will kill any running instance and restart it, then print out the PID of the new instance.

launchctl kickstart -kp gui/$UID/setUserKeyMapping

The problem solved for me!

sathninduk avatar Aug 13 '21 06:08 sathninduk

Thanks for suggesting but I've tried this method

launchctl enable gui/501/homebrew.mxcl.yabai
launchctl kickstart gui/501/homebrew.mxcl.yabai

The second comand hangs forever and yabai doesn't seem to start...

patricorgi avatar Aug 13 '21 11:08 patricorgi

Okay, it turns out I need to reinstall Rosetta 2 after this update; weird. Problem is solved.

patricorgi avatar Aug 13 '21 11:08 patricorgi

I've run into this issue, skhd randomly stopped working. Tried everything and nothing works.

I tried running the binary directly and I get an error about 'secure keyboard entry':

❯ /usr/local/opt/skhd/bin/skhd
skhd: secure keyboard entry is enabled by (1780) 'iterm2'! abort..

Then opened Terminal.app and got this dialog:

image

EDIT: Strangely I still get the error if I disable 'secure keyboard entry' in the iTerm menu.

EDIT: I restarted my machine, skhd asked for accessibility permissions, I removed the existing binary from the list in system prefs. and it added itself back after another permissions dialog popped up. I ticked it, now skhd is working again.

benwoodward avatar Aug 22 '21 02:08 benwoodward

For me it took a couple of trials to understand what was happening.

First, I tried to run skhd using /usr/local/opt/skhd/bin/skhd rather than the brew services start or restart.

The command above gave the following error: skhd: secure keyboard entry is enabled by (2638) 'terminal'! abort..

Now, despite having secure keyboard turned off on my terminal, it seemed that some app(s) is controlling that! so I ran ioreg -l -w 0 | grep SecureInput.

That will tell you the process ID (kCGSSessionSecureInputPID) of the application that has Secure Input enabled. You can then use ps auxww | grep NNN to find the process with the specified pid.

For me, the culprit turned out to be Keybase, uninstalling that gave me my skhd back!

Source: Disable Secure Input

ahmadassaf avatar Sep 09 '21 17:09 ahmadassaf

▶ ioreg -l -w 0 | grep SecureInput
  |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100009,"kCGSSessionSecureInputPID"=39020,"kCGSSessionGroupIDKey"=20,"kCGSSessionSystemSafeBoot"=No,"kCGSessionLoginDoneKey"=Yes,"kCGSSessionUserNameKey"="evgkirov","kCGSSessionIDKey"=257,"kCGSessionLongUserNameKey"="Evgeniy Kirov","kCGSSessionAuditIDKey"=100009,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})
    | |   "IOConsoleUsers" = ({"kCGSSessionOnConsoleKey"=Yes,"kSCSecuritySessionID"=100009,"kCGSSessionSecureInputPID"=39020,"kCGSSessionGroupIDKey"=20,"kCGSSessionSystemSafeBoot"=No,"kCGSessionLoginDoneKey"=Yes,"kCGSSessionUserNameKey"="evgkirov","kCGSSessionIDKey"=257,"kCGSessionLongUserNameKey"="Evgeniy Kirov","kCGSSessionAuditIDKey"=100009,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionUserIDKey"=501})

~
▶ ps auxww | grep 39020
evgkirov         39020   0.0  1.3  9256024 855320   ??  S    Sat06PM  28:31.75 /Applications/Safari.app/Contents/MacOS/Safari

I guess Safari 15 is problematic in that sense.

evgkirov avatar Oct 20 '21 13:10 evgkirov

Safari temporarily enables SecureInput when you're focussing a password field, and should disable it as soon as you stop focussing it. That's been the case even before Safari 15.

dominiklohmann avatar Oct 20 '21 13:10 dominiklohmann