Skip to content

Instantly share code, notes, and snippets.

@nall
Created July 16, 2010 05:03
Show Gist options
  • Save nall/477949 to your computer and use it in GitHub Desktop.
Save nall/477949 to your computer and use it in GitHub Desktop.
on run argv
set theServiceName to "SOMETHING HERE"
set theResult to "No Keychain entry found"
tell application "Keychain Scripting"
set isLocked to locked of current keychain
if (isLocked is true) then
unlock current keychain
end if
set allKeys to keys of current keychain
repeat with theKey in allKeys
if (class of theKey) is generic key then
if (service of theKey) is theServiceName then
set theResult to "Removed password from the keychain"
delete theKey
end if
end if
end repeat
if (isLocked is true) then
lock (name of current keychain)
end if
end tell
return theResult
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment