How can I copy on select in the OS X Terminal like PuTTY does?

122,422

Solution 1

Install SIMBL and then install TerminalCopyOnSelect.

  • At first, you should install SIMBL.
  • Download the zipped plugin file I mentioned above and expand it.
  • Copy the extracted file "TerminalCopyOnSelect.bundle" to the plugin directory which is located at ~/Library/Application Support/SIMBL/Plugins/
  • Terminate all processes of Terminal.app and restart it.

Solution 2

In Terminal, select something and then within the same Terminal window do one of the following:

  • click and drag the selection (a bit; the mouse pointer will change), and release to paste (hit Esc while dragging to cancel)

  • or: paste using Shift-Command-V

  • or: paste using the middle mouse button

Solution 3

iTerm, an alternative to Terminal, can do this.

Solution 4

iTerm 2 also has an option to copy text to the normal clipboard on selection:

You can remap the middle button to paste from the clipboard:

Like in Terminal, you can also use shift-command-V (Edit > Paste Special > Paste Selection) to paste the text that is selected elsewhere in the current window.

Solution 5

To answer your 4 questions:

That putty option to select and then right-click to paste in the best invention after the mouse. Is there anyway to make the terminal do this?

No, you can however select the text you want and drag-n-drop your selection to the command prompt.

Hack the source code?

Probably can be done through reverse engineering, but why bother for something so trivial, and the fact that it's illegal :P

Install something?

iTerm as kbisset suggests.

Are the source code for the mac terminal public available?

No but iTerm's is

Share:
122,422

Related videos on Youtube

Shiju Shaji
Author by

Shiju Shaji

Updated on September 17, 2022

Comments

  • Shiju Shaji
    Shiju Shaji over 1 year

    That PuTTY option to select and then right-click to paste is the best invention after the mouse. Is there any way to make Terminal in OS X do this? Hack the source code? Install something?

    Is the source code for the OS X Terminal publicly available?

    • Noumenon
      Noumenon over 3 years
      I suggest changing the accepted answer to the one with 4x the upvotes that doesn't require an install.
    • Timo
      Timo about 2 years
      '..best invention after mouse', plus one.
  • Josh
    Josh over 14 years
    I use Cmd-Shift-V all the time!
  • Shiju Shaji
    Shiju Shaji over 14 years
    This is cool. Already something, but what I really wanted was a: CopyOnSelectAndPaste Like putty!
  • Chris Page
    Chris Page over 12 years
    And so can Terminal. Edit > Paste Selection or Middle-Click if you have a three (or more) button mouse. Or drag the text a few pixels and release.
  • Chris Page
    Chris Page over 12 years
    “No, you can however select the text you want and drag-n-drop…” The answer is “Yes”. You can Middle-Click to do the same thing as Edit > Paste Selection. “right-click to paste” is likely a typo; either Sergio meant “middle-click to paste” or he’s using a terminal application with a “Paste Selection” contextual menu command.
  • Chris Page
    Chris Page over 12 years
    As @Arjan said, Terminal can do this: Choose Edit > Paste Selection (or Shift-Comamnd-V) or Middle-Click, the latter of which I assume is what you meant by “right-click” in your original question.
  • samkass
    samkass over 11 years
    Reverse engineering is not illegal in the United States. Not sure what country you're posting from, though.
  • Herr Grumps
    Herr Grumps almost 9 years
    Right click to paste is how it works in Putty (in windows) and I think maybe some Linux based terminal apps also. I haven't looked into it myself, but Karabiner should be able to "remap" right mouse button to middle mouse button (eg simulate a middle mouse button click) when the Terminal app has focus.
  • shams.haq
    shams.haq about 6 years
    Thanks for the middle mouse button tip! Feels like redemption!
  • Jasper de Vries
    Jasper de Vries almost 6 years
    This should have been the accepted answer ;-)
  • Arjan
    Arjan almost 6 years
    Nice. Command plus two-finger tap on the trackpad works too.
  • biesior
    biesior over 3 years
    I was looking for this because wanted to enable "copy on select" however drag and drop option made me happy :p
  • Nicolas Thery
    Nicolas Thery almost 3 years
    Despite any plugin quality, installing terminal Third Party Plugins is a bad idea.