Questions on Terminal... How to get rid of all this

When I open terminal this is how it opens..

How do I get rid of all of this..

MacBook Pro 16″

Posted on Aug 27, 2023 11:30 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 27, 2023 11:51 AM

The directions for switching from the bash shell to zsh are available in the following article, as was referenced:

https://support.apple.com/en-us/HT208050


The instructions for suppressing the message without changing the shell are also in that article, too. See this:

export BASH_SILENCE_DEPRECATION_WARNING=1


That -bash command string that was entered is not a valid shell command, which is what caused that error.

8 replies
Question marked as Top-ranking reply

Aug 27, 2023 11:51 AM in response to corner_monster

The directions for switching from the bash shell to zsh are available in the following article, as was referenced:

https://support.apple.com/en-us/HT208050


The instructions for suppressing the message without changing the shell are also in that article, too. See this:

export BASH_SILENCE_DEPRECATION_WARNING=1


That -bash command string that was entered is not a valid shell command, which is what caused that error.

Aug 27, 2023 3:46 PM in response to corner_monster

What I see is someone that appears to not know what they are doing in the Terminal and that can be very dangerous.


If you don't want to switch the original old Bash shell to Apple's new commitment to the Zsh shell, you don't have too, but you do still need to know how to edit your /Users/yourname/.bashrc or /Users/yourname/.bash_profile to include the


export BASH_SILENCE_DEPRECATION_WARNING=1


which will suppress the Terminal notification about The default interactive shell is now zsh text. You may want to enter the following commands to suppress the Last login message too:


cd
touch .hushlogin


If you do want to use the Zsh shell, then you need to perform some preparatory work:

  1. The Zsh shell does not read the Bash shell dot files , so you will need to create one that Zsh does read that contains PATH and shell prompt PS1 syntax.
  2. Set the default shell to Zsh
  3. Quit and relaunch the Terminal


Check if the following file exists in your home directory:

cd
more .zshrc


If it does not exist, you will see a shell error, .zshrc: No such file or directory. In that case alone, copy and paste the following into your Terminal window, followed by pressing the return key:


<<"EOF" > ~/.zshrc
export PATH=".:/usr/local/bin:${PATH}"
PS1="%m: %~ %% "
EOF


That will create a new .zshrc shell startup file in your home directory, with the PATH set so you can find UNIX commands and a shell PS1 prompt set:


/usr/bin/chsh -s /bin/zsh


and now quit the Terminal and relaunch it as the Zsh shell.

Aug 27, 2023 12:39 PM in response to corner_monster

A caveat to consider: certain shell commands in the shell environment can clobber much of your local user data, and some can clobber much of the data of all users.


What is your goal with the command line?


As for your question: are you entering that “-bash” command and that “$chsh -s path” command, as it appears to be the case? Neither of those are valid shell commands in either the bash or zsh shells, hence the errors shown.


Among the legions of valid commands for zsh, here are but a few:

print Hello
whoami
id
print "Hello there " $USER


I'm not aware of a (reliable) means to hush the display of the last login date and time string if that is what you are referencing, but adding a clear screen control sequence into your .zshrc file login can hide that output. (I wouldn't recommend this approach though, as clearing the display can also hide other messages that might appear.)

printf '\33c\e[3J'


But again, what is your goal for opening Terminal.app? What problem or issue or task are you seeking to solve with Terminal.app or more generally, assuming that is a little more involved than suppressing the last login time and date?

Aug 27, 2023 6:46 PM in response to MrHoffman

I can press cmd+T in the Terminal until I am bored and .hushlogin suppresses any Last login message for n-tuple added tabs — using one .hushlogin. I can also open n-tuple new Terminal windows, all of which suppress the Last login message. However, personally I do not use .hushlogin as I have seen Last login for so many decades that it no longer is a distraction for me.


There is /usr/bin/clear for clearing the Terminal window. It is curses based.

Sep 1, 2023 10:23 PM in response to corner_monster

I think @MrHoffman's question about why you are using the Terminal is extremely important. It is obvious you have never used the command line before. You need to realize that there is no safety net when using the command line. You issue the computer a valid command and it do exactly what that command is configured to do even if it is not what you expected the command to do. Even people with decades of command line experience can easily make a fatal error which can wipe out all their data just because of a simple typographical error.


If you want to use the command line, then you should at the very least learn the very basics of the command line so that you can figure out how to learn more and how to recognize danger. Here is one site which provides some basics on using the command line. The tutorial I'm linking utilizes the Bash shell, so you should leave the shell as it is until you learn the basics:

https://scriptingosx.com/2017/07/first-steps-in-terminal/


There may be better tutorials out there, but this is the best one I could find for macOS. Maybe one of the other contributors will have a better suggestion for a tutorial.


Once you learn some basics of the Bash shell, you should then be able to follow the directions already present here to either switch shells, or to hide the zsh change message. You really only need to understand the very basics. With the basics you will have enough knowledge to learn more advanced commands and options if necessary. I went for years with just a very basic knowledge of a few commands in order to manage my computers. Gradually I expanded that knowledge little by little.


Be very careful using any commands you find online since many of them may be highly tailored to a specific situation, system, or configuration. Plus while Linux utilizes many of the same commands as macOS, the macOS commands are usually older versions which are usually more limited and may have some different options & behaviors. Plus some commands meant for a Linux system may be damaging for macOS, if they work at all. Once you have a basic knowledge of the command line you will be able to investigate the commands listed and double check what they do before you try them. Never blindly enter any commands without understanding exactly what they will do. Sometimes it is not easy or even possible to reverse the changes made.


I highly recommend you have a good backup before you do anything within the Terminal app because you are very likely to do something catastrophic until you become a bit more familiar & comfortable with the command line. Or if you have an older or spare Mac, practice the command line there first.


Again, why are you using the command line? If we know the purpose of using the command line, then we may be able to assist you in that endeavor, but I do think you need to go through a command line tutorial or class first.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Questions on Terminal... How to get rid of all this

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.