Short version: Is there a way to force text field in OSX to accept pasting a string, despite that the developer (Apple) set it to not to accept copy-paste?

Long story:

Platform: OS X 10.8.2 (Mountain Lion)

Just connected a new external drive, set it to be encrypted (HFS+ encrypted partition). It works as expected.

The problem I have is that I have set a long, randomly generated password. As many others, I have saved this one in KeePassX. Everything would be great... except of the fact Apple does not allow me to simply paste a password into "enter password" dialog that is displayed after connecting a drive!

It is very annoying to rewrite long, random string from one window to second one each time when drive is detected. Is there any way to force the input field to accept pasted password?

To unlock disk "***", type password.

One solution would be storing password in OS X KeyChain, but... it seems that there is a bug with that. The 'input password' window does not disappear even after properly mounting a volume. I type password, click 'Unlock' and the controls are grayed out. After a few seconds, I see that drive appears in Finder, but 'input dialog' windows shakes like in case when wrong password was typed - and reverst back to it's original state. Additionally, despite of checked option to store password in KeyChain, it is not written there (I suppose those two may be related). So, checking "Store in keychain" does not solve my problem...

4 Answers 4


It's not really more convenient in this case, but you could run this in AppleScript Editor:

tell application "System Events" to tell process "SecurityAgent"
    set value of text field 1 of window 1 to the clipboard
    click button 1 of window 1
end tell

When I clicked the remember in keychain checkbox, the password was saved in the login keychain with the name of the volume, and the volume was subsequently mounted without requiring a password.

  • Well, this was a lot more convenient to me, since typing in my password would probably have taken ~20 minutes to get right :D
    – mikl
    Jul 25, 2013 at 10:46
  • It seems the update to OS X 10.8.5 has broken this somehow. Now I get this error: error "System Events got an error: An error of type -25133 has occurred." number -25133
    – mikl
    Sep 14, 2013 at 14:49
  • 1
    Works like a charm! I ended up replacing click button 1 of window 1 with keystroke return because it couldn't find the button index.
    – bobmagoo
    Dec 31, 2013 at 17:56
  • Thanks now I won't be forced to format my encrypted disk.
    – Cesar
    Apr 25, 2014 at 17:01
  • This may relate to stackoverflow.com/questions/60938199/…
    – Blauesocke
    Aug 23 at 6:15

I wrote a very tiny AppleScript application which allows you to paste passwords even where its not allowed by tricking the system into thinking that you're typing on your keyboard. The downside: it takes space in your Dock.


Another thing that still works is to drag and drop text into the prompt. Copy from your password store, paste it into TextEdit or similar application that lets you select text and move it in a OS X native manner. Select the text in TextEdit, then click the text and drag. Drag the selected text from TextEdit to the password input field. And boom the password drops in-place.

  • Works for me on MacOS Catalina 10.15.7, thanks!
    – Andreas F
    Mar 3, 2021 at 7:07

I tried the one way I thought might get around the cut & paste prohibition, which was to try using ctrlK and ctrlY, (Kill and Yank), but that also does not work.

This of course, gets back to the rationale of having a long, difficult encryption key to enhance security, but then having several copies of that key readily available in memory which can be accessed by any unprivileged process. However, there are several dozen 3rd party password managers, many free, on the App store that may meet your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.