CopyQ
CopyQ copied to clipboard
Unable to use GPG support on macOS
Before creating a new issue, see list of known issues.
Describe the bug I am using CopyQ on macOS Mojave - all is working well, but I want to use the Encryption add-on. I installed copyq using Homebrew, and then installed gnupg through Homebrew also. However on restart of CopyQ, I still see the message telling me to install GPG and restart CopyQ. The documentation details how to install GPG support on Windows and Linux, but I can't find out how to do it on macOS. I have both the gpg and gpg2 binaries available in the shell.
To Reproduce Steps to reproduce the behavior:
- Install copyq on macOS Mojave using Homebrew
- Install gnupg package using Homebrew
- Restart copyq
- See message asking for GPG to be installed for encryption support.
Expected behavior Successful install of GPG should mean Encryption options become available.
Version, OS and Environment
(Get details from copyq version
command if possible.)
CopyQ Clipboard Manager v3.11.1
Qt: 5.13.2
Compiler: GCC
Arch: x86_64-little_endian-lp64
OS: macOS Mojave (10.14)
Additional context Add any other context about the problem here.
Is gpg2
or gpg
in the PATH
when CopyQ is started? You can test this by opening Action dialog from the main window (F5 shortcut), typing gpg2 --version
and pressing OK (it should not pop up any error notification).
Also, what does gpg2 --version
print on stdout?
Thanks for this @hluk - this shows that gpg2 is not on the PATH when CopyQ is started.
Is there any guidance on how best to set this up on a Mac? I've installed both CopyQ and GPG through Homebrew. CopyQ now shows up in /Applications, and starts when may machine starts (as desired).
I've tried adding /usr/local/bin to /etc/paths, and running:
sudo launchctl config user path /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
However neither of these actions have made GPG available to CopyQ.
I hit this wall after installing CopyQ.dmg (v. 6.1.0) and GnuPG-2.3.6.dmg on MacOS 12.4 (Monterey). Solved it with an unsatisfying hack, but at least CopyQ encryption works like it does on other platforms without exposing every other App on the machine to a PATH change.
GnuPG installed:
/usr/local/bin/gpg -> /usr/local/MacGPG2/bin/gpg2
/usr/local/MacGPG2/bin/gpg2
It also added /usr/local/MacGPG2/bin
to the system default PATH, or so it appears:
% /usr/libexec/path_helper
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin"; export PATH;
As noted elsewhere, CopyQ -> F5 could not find gpg2 (or gpg), and the PATH in effect was just /usr/bin:/bin:/usr/sbin:/sbin
(Note: I use CopyQ "Autostart", but it made no difference if I exited CopyQ and re-launched).
I did not want to expose /usr/local/bin
or /usr/local/MacGPG2/bin
to every app in MacOS's launcher. However, when I tried tinkering with /Applications/CopyQ.app/Contents/Info.plist
, I never could get any change to take effect in the launcher (not even after lsregister
).
In the end, I went to folder /Applications/CopyQ.app/Contents/MacOS
, renamed file CopyQ to CopyQ.exe, and replaced file CopyQ with a shell script:
#!/bin/sh
eval "$(/usr/libexec/path_helper)"
logger "$(dirname "$0")/CopyQ" "$@"
exec "$(dirname "$0")/CopyQ.exe" "$@"
The MacOS launcher doesn't know the difference, and encryption works in CopyQ just like it does on other platforms. I will likely need to revert and repeat this hack whenever CopyQ is updated.