7

My login script is behaving oddly since I moved to Catalina. Particularly this line:

# set cursor to display path and command count
PS1="<: \w | \! :> "

Now my cursor actually has a \w and a \! in it. Before in my older Mac from about 4 years ago it would show the path and command count.

Also this command stopped working:

history -c

and gives an error.

I looked at the default shell using

echo $SHELL

and it gave

/bin/zsh

and the current shell using

echo $0

and it gave

-zsh
  • Don't include the answer in the question. – nohillside Apr 3 at 16:08
  • 3
    Also, Catalina doesn't migrate existing accounts from bash to zsh. Is this a new account, or did you migrate an existing one? – nohillside Apr 3 at 16:09
15

Your shell has been changed to Zsh, which is the default for new users on Catalina (10.15) and later. To go back to the old shell (BASH), run chsh -s /bin/bash (chsh is a "Change Shell command, the -s flag is "set", and /bin/bash is the location of the BASH shell). Then close and re-open terminal, or log out and log back in, and your shell will be bash again.

Alternatively, if you want to use the GUI, open System Preferences, Users and Groups, unlock the padlock at the bottom left, and control-click or right click on your user. Then, select "Advanced Options." There should be an entry called "Login Shell", which you can set back to /bin/bash.

Source: How to set shell in OS X - Super User

| improve this answer | |
7

Did the shell ( terminal ) change in Catalina?

These are two completely different things that have nothing to do with each other, so let's address them separately:

Did the terminal change in Catalina?

No. There might have been updates (although I don't think so), but there have not been any fundamental changes.

Did the shell change in Catalina?

Catalina still ships with the same shells that High Sierra did. There were probably some updates (I haven't checked), but no updates that fundamentally change the behavior of the shells. Also, there were no new shells added and no shells removed.

The one thing that has changed, is the default interactive login shell for newly-created user accounts, which is now Zsh instead of Bash. The reason for that is that macOS ships with a really old version of Bash, because Apple doesn't want to ship code under the GPLv3, so they ship the last version of Bash that is still under the GPLv2. Thus, Apple is trying to move users away from Bash, at least for interactive use.

Note, that this applies only to

  • the interactive login shell for a user, other shells are unchanged,
  • the default, the user or administrator can still change it if they wish,
  • newly-created user accounts, existing accounts will not be migrated automatically.

It is not quite clear why and how your login shell was changed to Zsh. That shouldn't have happened. It should only be changed for newly-created accounts, not for existing ones.

# set cursor to display path and command count
PS1="<: \w | \! :> "

Now my cursor actually has a \w and a \! in it. Before in my older Mac from about 4 years ago it would show the path and command count.

That snippet has nothing to do with the cursor. It changes the prompt. The cursor doesn't even have anything to do with the shell, it is managed by the terminal emulator.

The equivalent Zsh prompt escape sequences to the Bash ones you showed, would be:

  • %d / %/: current working directory
  • alternatively %~: current working directory; if the path starts with the home directory, replace the prefix with ~
  • %h / %!: current history event number
| improve this answer | |
  • 3
    I interpret shell (terminal) as meaning "the shell used in the terminal." not "I think the shell and the terminal are the same thing." – barbecue Apr 4 at 16:40
4

Yes. You were probably using bash shell. Catalina changed to zsh.

| improve this answer | |
  • 1
    Also, I can't get my file to execute on startup ... I tried placing .bash_profile in my home directory and it is ignored ... I also tried placing .bashrc in my home directory and it got ignored ... what does the zshell look for? why did it change? – j.a. Apr 3 at 15:54
  • now the z-shell reads the .zrc file. I think that's the name. It doesn't read the .bash_profile or .bashrc files. – jmh Apr 3 at 16:00
  • it reads the .zshrc file. – jmh Apr 3 at 16:07

You must log in to answer this question.

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