When you press 'y' (elfeed-search-yank) in an elfeed-search buffer, the selected entry's permalink url is copied to the emacs clipboard.

I don't have any automatic clipboard sync packages installed, and I don't intend to.

Is it possible to Meta-: Eval: and tell emacs to send whatever is in the emacs clipboard to the OS (MacOS) clipboard?

What I tried: browsed the source code for https://github.com/jkp/pbcopy.el/blob/master/pbcopy.el didn't see any interesting functions

NOTE: I'm using terminal emacs

If you are running a GUI Emacs, it should copy automatically everything that goes into kill-ring to the system clipboard. Are you running emacs in a terminal?

To answer your question, the code to copy the latest kill-ring addition to system-kill ring is:

(kill-new (current-kill 1))
  • yes I'm 99% of the time on terminal.app with emacs -nw . (kill-new (current-kill 1)) looked promising but didn't work. I'll try again later – american-ninja-warrior Feb 9 at 18:18
  • I do not think it will work from within terminal. – Heikki Feb 9 at 19:01
  • @joshsverns You should update your question with that information. See stackoverflow.com/a/32051871/3084001 for terminal support. – Basil Feb 9 at 20:57

You can call copy-to-x-clipboard from Meta-X or Eval:. No Emacs packages necessary. It relies on the pbcopy shell command, which is available in all macOS installations.

(defun copy-to-x-clipboard ()
  (switch-to-buffer (make-temp-name "scratch"))  
  (insert (current-kill 1))
  (shell-command-on-region (point-min) (point-max) "pbcopy")
  • The question relates to how to fetch some that was already copied to the emacs clipboard. elfeed-search-yank and many others copy entries to the emacs clipboard. When that happens, I need a way to upload that from the emacs clipboard to the OS (macOS) clipboard. – american-ninja-warrior Feb 10 at 16:48
  • And that's exactly what the above does. It gets the first item from the emacs clipboard, and pushes it to the macOS clipboard. – SamanGh Feb 10 at 17:54
  • I misunderstood – american-ninja-warrior Feb 10 at 18:03
  • No problem :-). – SamanGh Feb 10 at 18:25
  • machang how long you've been using emacs – american-ninja-warrior Feb 10 at 18:41

Is it possible to Meta-: Eval: and tell emacs to send whatever is in the emacs clipboard to the OS (MacOS) clipboard?


M-: (call-process-region (car kill-ring) nil "pbcopy")

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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