Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

KeePass will not copy and paste, let alone do autotype.

I have installed the KeePass 2.18 Mac package from I could not find a more recent Mac package for KeePass, so I also replaced all of that package's files with those from the Portable KeePass 2.20.1 (ZIP Package). That was from the page, link to actual zip: So I'm successfully running KeePass 2.20.1.

I'm running Mono version 2.10.9.

I'm running OS X 10.7.5 on a MacBook Pro.

I can't believe that KeePass's site touts Mac compatibility when it won't copy/paste. That's pretty core functionality to be missing. Searches reveal others have had this problem since 2.18, but no workarounds, no bug reports.

Has anyone been able to resolve this issue?

share|improve this question
Have you tried KeyPass with Mono 3.0? I haven't tried it but it might work better. – Old Pro Mar 25 '13 at 2:13
up vote 6 down vote accepted

The KeePass documentation in, although not specifically mentioning OS X, describes your issue:

Clipboard: On some systems, Mono's clipboard routines don't work properly. In this case, install the xsel package. If xsel is installed, KeePass ≥ 2.20 uses this utility for clipboard operations.

So xsel should help. (xsel is available from MacPorts ( The source is available here:

EDIT: But it doesn't. I was curious so I compiled xsel on my Mac. It didn't solve the issue with copy/paste (tested with Portable KeePass 2.20.1), as I feared, I must say. Why? Because as stated here xsel is a tool that manipulates the clipboard contents of X11 applications. X11 provides the graphical user interface for Linux and UNIX, but OS X uses Quartz instead, and so does Mono, as I realized (see

There's a workaround for copying username and password to clipboard, as explained in this thread

Ureka (sic). Your 2.19 is on the path to copy paste working on the MAC via Mono! Your button to copy the username, and your button to copy the password works now!!!

The poster above refers to these buttons (portable KeePass 2.20.1 shown running on Windows (sorry, no Mac nearby)):

For copying the username:

enter image description here

For copying the password:

enter image description here


I'd like to share how I compiled xsel in case somebody needs it on OS X:

  1. Install X11 from (this only applies to OS X 10.8 "Mountain Lion" users).

  2. Symlink header and library files from /opt/X11/include/X11 to /usr/local/include/X11 and from /opt/X11/lib to /usr/local/lib (alternatively you can symlink to /usr/include and /usr/lib):

    $ sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
    $ for lib in $(ls /opt/X11/lib/lib*); do sudo ln -sf $lib /usr/local/lib; done

    Otherwise you will get lots of errors about files not found or missing symbols. I tried passing the non-standard X11 directories as an option to ./configure without success.

  3. Download from and extract, for example, to your Desktop.

  4. You need gcc plus libraries. Install Xcode and then install the command line tools from Xcode>Preferences>Downloads>Components.

  5. Change directory, configure and compile:

    $ cd xsel-1.2.0
    $ ./configure --prefix /usr/local
    $ make
    make  all-am
    if gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -fno-strict-aliasing -Wall -Werror -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused -MT xsel.o -MD -MP -MF ".deps/xsel.Tpo" -c -o xsel.o xsel.c; \
        then mv -f ".deps/xsel.Tpo" ".deps/xsel.Po"; else rm -f ".deps/xsel.Tpo"; exit 1; fi
    gcc  -g -O2 -fno-strict-aliasing -Wall -Werror -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused   -o xsel  xsel.o  -lX11
    $ make install

You can also install xsel with MacPorts using the command sudo port install xsel. In my setup it also required the symlinks for the X11 libraries and header files and needed much longer to compile.

I'd also like to share some caveats when using KeePass on a Mac:

  1. KeePass 2.18 (from has trouble with case-sensitive HFS+. KeePass.exe is typed Keepass.exe (notice lowercase 'p') in (so that it silently fails). I had to use a USB flash drive formatted with case-insensitive HFS+ and run KeePass from there.

  2. I had a lot of trouble getting KeePass 2.20.1 to work on OS X 10.8 "Mountain Lion". It couldn't get rid of the error message:

    System.ArgumentException: Directory does not exists
    Parameter name: path
      at System.IO.FileSystemWatcher..ctor (System.String path, System.String filter) [0x00000] in <filename unknown>:0 
      at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher:.ctor (string,string)
      at KeePass.Util.IpcBroadcast.FswStartServer () [0x00000] in <filename unknown>:0 
      at KeePass.Util.IpcBroadcast.StartServer () [0x00000] in <filename unknown>:0 
      at KeePass.Forms.MainForm.OnFormLoad (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 
      at System.Windows.Forms.Form.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 
      at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) [0x00000] in <filename unknown>:0

    I finally found the culprit: The release notes for version 2.20.1 state (

    Changes from 2.20 to 2.20.1: On Unix-like systems, KeePass now stores most of its temporary files in a private temporary directory (preferably in $XDG_RUNTIME_DIR).

    According to

    $XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user ...

    XDG_RUNTIME_DIR was not set. I set it to a directory I owned and KeePass worked like a charm:

    $ echo $XDG_RUNTIME_DIR
    $ mkdir ~/.mono
    $ export XDG_RUNTIME_DIR=~/.mono/; mono --desktop /Volumes/USB_Flash_Drive/KeePass-2.20.1/KeePass.exe

enter image description here

share|improve this answer
Installing xsel: kudos for at least finding it. But no installable pkg found and it won't compile for me. Need to add gcc to my path (at least). So the solution that worked for me is the last link....but let me be clear about the part of that that worked: installed 2.18 pkg, copied 2.20.1 over it, then the buttons (and ONLY the buttons, not the shortcut keys ctrl-C ctrl-V) do work. The buttons...that's what I missed when I read that link (before I asked this question). – minnow Nov 9 '12 at 15:01
Comments only editable for 5 minutes. Very irritating. Anyway: before any mac-police pounce, the shortcuts (that don't work) are of course Command-C and Command-V. Global auto-type: I did not try XDOTOOL. I have no shortcuts, no auto-type, but I do have BUTTONS. Good enough for now. BUTTONS! Why should I be disappointed? I-I definitely have the BUTTONS. I mean, those are BUTTONS!" (a la Tom Cruise in Rain Man: I got the rose bushes.) – minnow Nov 9 '12 at 15:23
@minnow: I could finally test xsel with KeePass and guess... no, it didn't work, so, as for now, using the buttons is the only possibility on OS X to copy usernames and passwords. I've added it to the answer. I've noticed that Softpedia links to the xsel source code, so I've deleted that bit from my answer. – jaume Nov 9 '12 at 23:50
Apparently the buttons exist and work in 2.24 version that I am currently using. Did not realize that toolbar buttons can do it differently than context menu. Thank you for sharing the answer! – Mike Oct 14 '14 at 14:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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