Skip to content

Instantly share code, notes, and snippets.

@dasilvacontin
Created April 29, 2018 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasilvacontin/879cbb924aad3b35847a2f8950ca1320 to your computer and use it in GitHub Desktop.
Save dasilvacontin/879cbb924aad3b35847a2f8950ca1320 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
const { execSync } = require('child_process')
function denyApple () {
const ps = execSync('ps -ef | sed 1d').toString().split('\n')
const systemPrefsInfo = ps.find(p => p.indexOf('System Preferences') > 1)
if (systemPrefsInfo != null) {
const pid = systemPrefsInfo.trim().split(' ').filter(s => s.length)[1]
execSync(`kill -9 ${pid}`)
} else {
setTimeout(denyApple, 500)
}
}
denyApple()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment