I see a nicely colored output in my terminal.
The terminal has a "Export Text As" command but it saves a plain-text file without the colors. Same with copy&paste.
Do you know a way to save terminal output including colors?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
It appears that if you select text in the Terminal, then copy it, then paste it into an application that supports rich text (e.g. Mail, TextEdit, Word), then the text color will be preserved.
It appears that in Mail and TextEdit, the background color of the terminal is also pasted; in Word, it is not. I'm not sure how to explain this discrepancy.
you can try to paste the colored output to the clipboard like this:
% command_which_produces_colors | pbcopy -prefer rtf
which puts some rtf (possibly colored and formated) stuff into the pasteboard of macos. you can then use any other that understands richtext to access the clipboard.
this is obviously not the same as "select it with the mouse" but maybe worth a shot.
Based on @akira's answer, I came up with the following:
brew install ansifilter)
<command that produces colors> | ansifilter --rtf | pbcopy -Prefer rtf
<command that produces colors>to force it to produce colors even though its output is piped, e.g.
ls --color=alwaysinstead of just
OS X has several keyboard shortcuts (hotkeys) for copying the screen. These will save your screenshots as a jpg files on the desktop. Here's a list of them:
Cmd-Shift-3 Take snapshot of the whole screen Cmd-Shift-4 Take snapshot of the selected area Cmd-Shift-4-Spacebar Take picture of a window Escape Cancel Hold Spacebar after Drawing the region Move the selected area Hold Option Resize selected area Hold Shift Resize selected area horizontally or vertically
There's also a "Grab" application located in the Applications | Utilities folder that does the same job, plus has a few extra features such as delay.
In Snow Leopard (10.6.8) the default screenshot format is png not jpg, although that can be changed to any one of many others -- including pdf -- using the free 3rd-party TinkerTool preference settings utility.
The way I do this is via the excellent Textmate 2 app.
I have to say it would nice if shift-cmd-c worked directly in the R console window.