49

After the update to Mavericks (10.9), anything copied from Terminal is pasted in the target app with the same formatting as in Terminal, in my case, white monospaced letters on a black background, e.g.:

Problem

(I pasted some text from Terminal into a New Mail window.)

Previously (10.8 and earlier) only plain text was copied, without any formatting at all.

This happens in apps that are capable of receiving rich text formatting. In plain text apps, e.g. TextWrangler or TextEdit in plain text mode, only the content is copied, of course.

Can formatting copying be disabled for the Terminal app?

The same happens in Yosemite (10.10) and El Capitan (10.11) as well.

  • 2
    Use iTerm2 - the usual comment when somone has a Terminal issue :) or write emails in Plain text not rich text. – user151019 Nov 5 '13 at 17:59
  • I do not believe that formatting of copied text can be disabled. My solution was to install the app Flycut which is a clipboard manager that will remove formatting from text copied from any application. – Dave Nelson Nov 5 '13 at 18:04
  • 1
    @Mark It's not just about emails, it's about any rich text app. – pilsetnieks Nov 5 '13 at 18:13
  • @pilsetnieks any particular reason you un accepted this 4.1/2 months later :-O. Do you need more help? – markhunte Mar 10 '14 at 22:18
  • @markhunte Sorry, your answer is still very valid and appreciated, it's just that Tim K's answer answers the question exactly. I hadn't seen the answer until I revisited the question yesterday, since it was posted 3 months after asking. – pilsetnieks Mar 11 '14 at 10:25
57

You can disable copy/pasting the formatting from Terminal by changing the com.apple.Terminal preferences file.

Open Terminal on your Mac and enter the following command: defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.no-attributes

This will strip all text attributes out of copy/pasting from Terminal

  • To confirm, it is the same process as above in macOS Sierra. – Anthony Attard Nov 12 '16 at 0:02
  • To revert defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.attributes. – Saurabh Shrivastava Dec 13 '18 at 5:48
14

Just use 'Paste Matching Style'

enter image description here

Which will keep the formatting as the same as the insertion point

So instead off:

enter image description here

You would get:

enter image description here

  • 4
    Yeah, "paste and match style" works, I was just hoping for a solution that wouldn't involve relearning keyboard shortcuts. – pilsetnieks Nov 5 '13 at 18:15
6

In El Capitan, you can set the formatting in Terminal app. Simply select Edit -> Copy Special and select Plain Text for no formatting or you can create a profile that looks good when pasted in a document.

  • 2
    This should be the top answer at least for El Capitan and above. – akhan Jan 13 '17 at 20:44
4

You can configure a global keyboard shortcut as described in this post: http://ask.metafilter.com/187733/OSX-How-to-copy-plaintext-always-everywhere-without-exception

This solved it for me. I am working on a big visio diagram and I need to copy stuff from terminal and paste it into visio a few hundred times a day - so this change in 10.9 was a big blow for me.

  • Note that using this method I can no longer paste text into Apple Mail Subject, URL or Contact fields on Mavericks. – MikeiLL Jun 25 '15 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .