I use git from within Terminal.app, and will occasionally end up (particularly after a merge resolution) with something like:

$ git status
  Untracked files:

Where the whitespace before foo is a tab character.

Since Mojave, copying and pasting that line (which I want to do to rm the file) results in an alert (complete with loud bonk) asking me to confirm whether I want to paste the nasty control characters.

Anyone know if either:

  1. there's a way to disable the alert and just paste with the control characters, or
  2. there's a keyboard shortcut to paste without the control characters?

FWIW, I understand that there are other ways to remove the file (e.g. git status|grep orig$|xargs rm) and I understand why, in the general case, you'd want to limit pasting of control characters.

  • Don't copy the control characters? Dec 11, 2018 at 10:50

3 Answers 3


Update your OS to 10.14.1 or later

It seems that Terminal in 10.14 would present this dialog when pasting a tab character, but the updated Terminal in 10.14.1 and 10.14.2 does not.

I was scratching my head as to why I was only able to reproduce this issue on one install but not another. Unable to find any settings that had any impact, I eventually tried updating the machine that showed the dialog, and it was gone.


So, keep in mind, the tab character, Unicode U+0009 "CHARACTER TABULATION" (UTF-8/ASCII hex 09) is simply a regular character. One that is very annoying to deal with, yes. But it is not a 'control character'. This is different what happens when you press the key on your keyboard labeled tab, which might be mapped to an escape sequence/control character like '\t', which is different.

The specific issue you encountered is indeed "fixed" in 10.4.1+. However, this still doesn't mean you're not going to encounter this or similar errors.

For example, take the sequence:

printf '\033[34mEscape!\033[00m\n'

And try copy/pasting it (or its output) into different shells. Also try setting the Terminal.app setting 'Escape Non-ASCII input with Control-V', or using control-command-V, "Paste Escaped Text". Kinda weird stuff, eh?

  1. Within a terminal, your best bet for most things is:
    • Generally, never use the ⌘C and ⌘V shortcuts to access the clipboard.
    • Instead, pipe to the pbcopy command, and then use pbpaste as needed.

So, this would be git status | pbcopy, and for some this you might want to copy, you might need to combine stderr and stdout: git error 2>&1 | pbcopy will result in an empty clipboard without 2>&1.

This still may strip out proper control characters (anything that isn't valid UTF-8). But as you mentioned, you're already aware of why you might not want to copy and paste these. If you're set on capturing "control characters" as well as text, what we're really talking about is just capturing a byte stream, so it is probably best to avoid the clipboard altogether, which has never had the functionality of reproducing arbitrary byte sequences.

P.S. Have you considered switching to iTerm2?

  • 1
    > So, I myself don't encounter what you're experiencing, actually. But I'm going to answer to what I think is the heart of your question as per the title "Mojave: Pasting text with control characters". < I don't see it myself any more, and had largely forgotten about the problem until I saw inbox responses the last few days. I suspect it was fixed in 10.14.1.
    – chrisbtoo
    Dec 13, 2018 at 18:09
  • @chrisbtoo I can confirm it was in-fact fixed in either 10.14.1 or 10.14.2. If you have tested it with 10.14.1 feel free to submit an edit on my answer to narrow down the version. Dec 13, 2018 at 22:54
  • I rolled back to 10.14.0 and can confirm this specific issue is 10.14.0 related. But there remains the issue of the second question, "Anyone know if... there's a keyboard shortcut to paste without the control characters?" Which I take as "safely cut/paste control characters", which I don't really find addressed. So I'm gonna trim this answer down and give a general example; alternatively @AlexanderO'Mara if you wanted to integrate the core of it, I'd delete this one. Dec 18, 2018 at 14:12

I would try granting Terminal full disk access in system preferences.

You can do this as follows:

  1. Go to Apple > System Preferences...
  2. Click on Security & Privacy
  3. Select the Privacy tab
  4. In the left hand pane, select the Full Disk Access option
  5. Now click on the padlock at bottom-left of the window
  6. Enter your Admin password and click on the Unlock button
  7. Now click on the + button at the bottom of the right-hand side list
  8. Navigate to the Terminal app (usually located inside the Utilities folder within your Applications folder) and open it (Note: If Terminal was already running you'll be prompted to quit it first)
  9. Remember to lock the padlock again

Now try pasting text with control characters into Terminal and see how you go.

You must log in to answer this question.

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