Text copied from Terminal with formatting in Mavericks (10.9), Yosemite (10.10), and El Capitan (10.11)

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.


Solution 1:

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

Solution 2:

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