I was using Linux for the last couple of years and I find it extremely useful to copy text by highlighting it as well as to paste by clicking a middle mouse button.
I'm using a Mac now and I wonder if I can achieve such behaviour on Mac OS X.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityI was using Linux for the last couple of years and I find it extremely useful to copy text by highlighting it as well as to paste by clicking a middle mouse button.
I'm using a Mac now and I wonder if I can achieve such behaviour on Mac OS X.
I wrote a free little C program that does something similar to Gilligan's answer. Whenever you drag-highlight or double-click text, it copies to the clipboard buffer. Then you can middle-mouse-click in any window to paste it. It is called "macpaste" and on Github (https://github.com/lodestone/macpaste). It works globally for every program I use that has textual data.
In iTerm2, disable their middle-click in Preferences, otherwise you'll get double pastes.
Undefined symbols for architecture x86_64
– Peter Ehrlich
Jun 2 '17 at 18:45
macpaste
is that it breaks middle click for everthing else. For example, I cannot middle-click to close tabs in Chrome, or middle-click to open a link in a new tab.
– aggregate1166877
May 22 '19 at 21:13
You can try BetterTouchTool. You can assign custom trackpad, mouse, and keyboard events to trigger specific actions on a global or application-specific basis.
Here's my configuration to bind a three-finger tap to ⌘V (as this is the global paste shortcut. Alternatively you can select from dozens of other trackpad and mouse gestures to emulate the paste command.
The macOS terminal can do copy/paste with two separate buffers:
Create the following Automator service:
Assign it a keystroke, like ⌘⌥shiftcontrol] (something unlikely to conflict with anything). Then, use BetterTouchTool to assign that keystroke to the middle mouse button.
The middle shell script comes from this fine answer. The first shell script copies the selection to the clipboard, the middle script clicks the mouse at its current location, and the AppleScript sends a ⌘V to paste the contents of the clipboard
After highlighting text in the Terminal, I can middle-click to paste it back into the Terminal without using the copy/paste keyboard shortcuts. This does not seem to work when the text comes from other applications ie. I can't copy text from TextEdit and then paste into Terminal with a middle-click. I am running Lion and I did not have configure anything to get this default behavior. I'm not sure about other versions of OS X.
I tried the Automator script suggested by Daniel. It did NOT work for me on OS X 10.10.
I was able to make BetterTouchTool (v 1.15), alone, work for some applications. Like this:
I did Left Mouse twice for several reasons. The first one usually only changes the focus to the new window, but does not position the cursor. Also, clicking in a text box usually selects all of the text, which is then deleted when something is pasted there. I usually want the original text to stay.
Gilligan
I don't think there is a way in general but some programs will accept the middle button as paste
e.g.
Aquamacs - an OSX configured emacs
iTerm2 - a replacement for Terminal
For newer mice/trackballs clicking the scroll wheel acts as a third button
Select Text to be copied, then Drag and Drop your selection (White Plus sign in red circle will be displayed with the cursor). This will copy-paste the text.
You can Drag and Drop inside Terminal or between apps.
I would like to add that, if the problem is, as it was with me, that you couldn't get stuff that was highlit in an X-Quartz window onto the clipboard, the secret to that is to highlight, then XQuartz menu-> Edit -> Copy. That way, it is available for paste in every ordinary Mac OS app.
In majority of terminals you can drag and drop the highlighted text or alternatively you can use: Shift + ⌘ + v
It will act like in Linux pressing middle-mouse button ( is a copy and paste together)