What might fix an installation of KeePass that won't copy or paste on OS X?
KeePass will not copy and paste, let alone do autotype.
I have installed the KeePass 2.18 Mac package from http://keepass2.openix.be/. 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 http://keepass.info/download.html, link to actual zip: http://downloads.sourceforge.net/keepass/KeePass-2.20.1.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?
The KeePass documentation in http://keepass.info/help/v2/setup.html#mono, 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 (http://www.macports.org/ports.php?by=all&substr=&page=316&pagesize=50). The source is available here: http://www.vergenet.net/~conrad/software/xsel/#download)
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 http://www.kfish.org/software/xsel/ 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 http://www.mono-project.com/WinForms#About_System.Windows.Forms).
There's a workaround for copying username and password to clipboard, as explained in this thread http://sourceforge.net/projects/keepass/forums/forum/329221/topic/5106260:
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:
For copying the password:
EDIT:
I'd like to share how I compiled xsel
in case somebody needs it on OS X:
Install X11 from http://support.apple.com/kb/HT5293 (this only applies to OS X 10.8 "Mountain Lion" users).
-
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. Download from http://www.vergenet.net/~conrad/software/xsel/#download and extract, for example, to your Desktop.
You need
gcc
plus libraries. Install Xcode and then install the command line tools from Xcode>Preferences>Downloads>Components.-
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:
KeePass 2.18 (from http://keepass2.openix.be) has trouble with case-sensitive HFS+.
KeePass.exe
is typedKeepass.exe
(notice lowercase 'p') inKeePass2.18.app/Contents/MacOS/startkeepass.sh
(so that it silently fails). I had to use a USB flash drive formatted with case-insensitive HFS+ and run KeePass from there.-
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 (http://keepass.info/news/n121004_2.20.1.html):
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 http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html:
$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