Configure emacs to cut and copy text to Mac OS X clipboard Can I configure emacs, so that I could copy/cut text from emacs (default Terminal version) and paste it somewhere else (into X Window program)?
Add this to ~/.emacs:

(defun pbcopy ()
  (interactive)
  (call-process-region (point) (mark) "pbcopy")
  (setq deactivate-mark t))

(defun pbpaste ()
  (interactive)
  (call-process-region (point) (if mark-active (mark) (point)) "pbpaste" t t))

(defun pbcut ()
  (interactive)
  (pbcopy)
  (delete-region (region-beginning) (region-end)))

(global-set-key (kbd "C-c c") 'pbcopy)
(global-set-key (kbd "C-c v") 'pbpaste)
(global-set-key (kbd "C-c x") 'pbcut)


If you use Emacs in iTerm 2, you can also remap key combinations in the preferences:



Then add something like this to ~/.emacs:

(global-set-key (kbd "&lt;f13&gt; c") 'pbcopy)
(global-set-key (kbd "&lt;f13&gt; v") 'pbpaste)
(global-set-key (kbd "&lt;f13&gt; x") 'pbcut)