I am working a lot with terminals in a Mac with OS 10.13.6 and I want to set a title of a terminal (I have several terminal tabs open).

I know that I can select the tab, go to Shell -> Edit Title and set the title of the terminal.

However, when I - for example - run a command, login to some other computer etc. - that title is always overwritten.

How can I have a FIXED title for a Terminal Tab FOR ALL TIMES (except I turn off/reboot the laptop)?

Complete example so that my question is REALLY understood:

  1. I open a terminal in the Mac
  2. In the manu of the Terminal I select Shell -> Edit Title and change the title: enter image description here
  3. The title of the tab is like I want it: enter image description here
  4. In that terminal I start ipython (AS AN EXAMPLE!!!).
  5. The title has been changed. This NOT what I want! enter image description here
  6. I still want the title to be 'Test Title'.
  • What steps do you follow to install which version of ipython?
    – bmike
    Commented Jan 22, 2019 at 10:15
  • 4
    Irrelevant. I want a fixed terminal title. I cannot tell you how I installed every single application.
    – Alex
    Commented Jan 22, 2019 at 11:13
  • My steps work for me, sorry for asking for more detail so I could try and reproduce that my steps work for ipython in addition to the things I tested. (Normal python, bash, fish, vi). I was curious if you just didn’t follow the steps we did or have some other non default item. No worries if you are happy with the answers or waiting for more eyeballs to help.
    – bmike
    Commented Jan 22, 2019 at 12:03
  • I do not know how I did install any application. But when the title of a tab changes - then its the TAB that changes the title (or maybe the terminal application). THAT application is responsible for changing the title of the tab.
    – Alex
    Commented Jan 22, 2019 at 12:14
  • I can try to explain in my answer better. All programs can send the message to ask terminal to change the tab or change the window titles. Terminal can ignore those commands. One answer explains how to intercept the sending. I explained how to ignore what is sent and that ignore works for every program I try. 100% success in never changing the tab title like you ask.
    – bmike
    Commented Jan 22, 2019 at 12:17

3 Answers 3

  1. Open the Preferences for terminal app
  2. Select the profile in use
  3. Select "tab" pane on the right
  4. Uncheck everything except Show activity indicator

terminal settings to prevent bash and shell escape sequences from showing in terminal tabs and title area

Repeat the above for Window title if you want that to change in addition to the tab title. Now, you will only get the defaults when you make new tabs/windows and your manual changes will persist and not reflect the variables that endeavor to provide status each time the command line prompt is regenerated.

Window preferences in terminal.app on macOS Mojave dark mode

  • As an aside, it's hard to resist pointing out the "Escape sequence..." explanation. It's one of the clearest primers I've seen on the whole PS1 / PROMPT_COMMAND / OSC escape sequence rabbit trail that you have to go down to customize these updates. Your case is simple, just turn them off as opposed to crafting or overriding them...
    – bmike
    Commented Jan 19, 2019 at 11:35
  • 1
    Thanks for that extensive explanation, but it does not seem to work. I have changed the tabpreferences as suggested, then I change the title in the Inspector, but as soon as I run e.g. ipython the title changes. It seems like the tab title is removed the the terminal title replaced by the IPython title. I have made the changes exactly as suggested...
    – Alex
    Commented Jan 20, 2019 at 8:16
  • Are you certain @alex that you unchecked / disabled all 9 window items and all 6 tab items, leaving only “show activity” on as that is irrelevant to the processing of the change messages that ipython and just about every other command will send? I can start and stop the updating at will using only the two preference windows above on all my Macs. I suppose if your terminal preference store is corrupt, you could click and the app is broken... try making a new user account and retest?
    – bmike
    Commented Jan 22, 2019 at 12:20
  • Yes I just checked again with the current user. I can try with a new user account, but it will take a while. I do not know how to make a new user on a mac...
    – Alex
    Commented Jan 22, 2019 at 15:30
  • 1
    Oh, I think the place I'm SSHing to has the escape characters in its .bashrc file. ` PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' seems to be resetting the title even if you don't have the checkboxes checked.
    – xaxxon
    Commented Aug 7, 2019 at 21:11

Most likely, the Terminal title is set in the PROMPT_COMMANDvariable that set in .bash_profile

For the location’ see Changing the Title of an SSH connection.

Just remove the ${HOSTNAME} variable from the prompt on the remote machine’s ~/.bash_profile

  • I am not talking about the title of a ssh connection. I am talking about the title of a terminal tab.
    – Alex
    Commented Jan 18, 2019 at 12:22
  • 1
    The answer is exactly the same. The title of your shell window is changing because something in the shell running inside is changing it. Remove what's changing it. Commented Jan 18, 2019 at 13:21
  • It's typically Escape Codes being set that causes your tab/window title to change. The most likely place is your prompt. Where ever you set your prompt (most likely ~/.bash_profile or ~/.bashrc) is the cause.
    – Allan
    Commented Jan 18, 2019 at 17:05
  • None of the suggestions will work when I run e.g. ipython, as there is no ssh connection involved. The title of the tab changes!!
    – Alex
    Commented Jan 19, 2019 at 8:49

You can go to preferences / profile / window and there is a text box for you to name the terminal window. There are also checkboxes underneath the text box to add other information to the name. There are similar options in iTerm2.

  • 1
    This does not seem to work. I deactivated some options, but when I e.g. start ipython the title of the tab is changed again.
    – Alex
    Commented Jan 19, 2019 at 8:48
  • Yes i see. I don't understand unless there is a command in iPython to change the terminal name.
    – Natsfan
    Commented Jan 19, 2019 at 16:52
  • I am pretty sure its not because of python, but because MacOS is a stupid operating system...
    – Alex
    Commented Jan 20, 2019 at 8:45
  • @Alex Well Unix has been around for many years so enough people like to keep it around for 50 years. Is sure beats the hell out of Windoze and Linux is just Unix for PCs. So what OS are you using that makes Apple so bad?
    – Natsfan
    Commented Jan 20, 2019 at 15:35
  • Apple Operating system.
    – Alex
    Commented Jan 20, 2019 at 16:02

You must log in to answer this question.

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