106

Yesterday my terminal started surrounding commands that had been run with square brackets. I'm not sure how I've turned this on, but would like to turn it off.

Example: Square brackets around commands

So far, I've done:

  • Checked that there's nothing funny in my .bash_profile
  • Tried changing the profile back to Basic
  • Tried changing to a different shell (zsh)

I've not been able to uncover anything on Google either.

Any ideas?


Update

Output of echo "$PS1"; echo "$PROMPT_COMMAND" enter image description here

9
  • ? What exactly do you mean? There aren't any [] in your screenshot?
    – Tonny
    Sep 18, 2015 at 11:16
  • 6
    @Tonny look at the far left and right of the first line - right up against the window edge
    – Josh
    Sep 18, 2015 at 11:37
  • I see: it's the whole line including the prompt. I was focussing on just the command. I can't recall ever seeing that on my own Mac. I just checked and it isn't present on my 2 Mac's, both run Yosemite, bash with the vanilla config, i never changed that on either machine.
    – Tonny
    Sep 18, 2015 at 13:21
  • 1
    @glennjackman I've updated the question with a screenshot of the output. Googled it, and it looks to be the system defaults.
    – Josh
    Sep 19, 2015 at 11:15
  • 1
    You did not turn it on. The new Marks feature automatically marks prompt lines by default. See here for an explanation about this feature: apple.stackexchange.com/questions/209635
    – Chris Page
    Nov 3, 2015 at 19:40

3 Answers 3

140

Got it! Somehow I'd accidentally turned "Automatically Mark Prompt Lines" on:

enter image description here

I do wonder though where that configuration is stored on disk, as I also tried:

  • Deleting ~/Library/Preferences/com.apple.Terminal.plist
  • Running Terminal from my Yosemite partition (didn't show the marks)
  • Extracting a fresh copy of Terminal from the El Capitan installer (did show the marks)
6
  • Deleting the plist may not have been enough. The cfprefsd changes in the last couple of years means that it’s not quite so simple to trash preferences any more. Oct 2, 2015 at 15:46
  • 2
    Also: what does “mark prompt lines” mean, and why would you want it? Oct 2, 2015 at 15:46
  • 13
    I think El Capitan turns this on by default I was going crazy until I saw your answer. THANKS!
    – victmo
    Oct 3, 2015 at 20:40
  • 4
    See here for an explanation about this feature: apple.stackexchange.com/questions/209635/…
    – nwinkler
    Oct 9, 2015 at 19:20
  • 6
    This was automatically turned on El Capitan for me as well. Amazing how irritating this tiny little graphical anomaly was. Thank you very much for figuring this one out!
    – Zen
    Nov 20, 2015 at 1:48
29

View > Hide Marks hides these square-bracket lines, without removing the ability to navigate with them, giving the best of both worlds.

2
  • What is the difference between "Automatically Mark Prompt Lines" and "Hide Marks"?
    – Nawaz
    Apr 18, 2017 at 6:58
  • 1
    A "mark" on a line is a semantic entity that allows you to navigate back to commands (See Edit > Navigate). Hiding marks removes the visual element, while preserving the location in your terminal. This is the "best of both worlds" because you can still quickly scroll back to your last command, but aren't distracted by the little []s Aug 25, 2017 at 16:01
7

The preference for turning off prompt marks is:

defaults write com.apple.Terminal AutoMarkPromptLines -int 0

The best write up I have seen on how to use marks is at:

You can also skip one mark if you leave them enabled by pressing Command-Shift-Return to skip marking just this one command line.

3
  • 1
    Directly writing the preferences with the implementation-specific key is unnecessary: just use the View > Show/Hide Marks menu item.
    – Chris Page
    Nov 3, 2015 at 19:37
  • 5
    Of course not @ChrisPage - but it's nice to have the choice for those of us that script our standard setups or desire to change a lab with 100 computers ;-)
    – bmike
    Nov 3, 2015 at 19:51
  • 3
    In that case I think this answer would be improved if it mentioned that, and first described the menu item. The question is about an individual user interacting with an application, not trying to configure a set of computers.
    – Chris Page
    Nov 3, 2015 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.