Changing MacOS Terminal shell from Bash to Zsh: what’ll it mean for me?
February 11, 2020 1:31 AM   Subscribe

I have some experience using Terminal on my Mac, but only for basic stuff like searching for orphaned files using wildcards, altering video metadata with ExifTool, showing hidden files (yes, I now know there's a keyboard shortcut for that), and a few other random actions that I've learned about by Googling. I'm aware that in Catalina (MacOS 10.15.x) the default shell in Terminal will become Zsh if I run a command to update it. So far I haven't done that. What will making the switch to Zsh mean for a novice like me?

I'm not really sure how Bash vs Zsh matters, or what the shell actually is, aside from a kind of syntax, I gather? So that leads me to wonder if changing to Zsh means I'll have to use different commands than I've previously used, or if I'd be able to use the same commands but I'll have to use them in a different way, or if it really doesn't mean anything will change.
posted by theory to Computers & Internet (12 answers total) 1 user marked this as a favorite
It probably won't be a change for you at all. The way tab completion is different out of the box, but most of the changes between the two shells show up when you are scripting or doing more advance configuration.
posted by adventureloop at 1:44 AM on February 11, 2020 [2 favorites]

For how you use it there is essentially no difference. bash (Bourne again shell) is a decendent of the bourne shell (sh) as is zsh.

posted by koolkat at 1:46 AM on February 11, 2020 [2 favorites]

It's been fine for me. You know you can try out zsh in any terminal window, right? Try sourcing your config files from a zsh subshell, see how it goes.
posted by kingless at 2:32 AM on February 11, 2020

Short answer, you're not likely to notice much of anything has changed. Continue to run the same commands and everything will likely Just Work.

Longer answer: some things I can think of that you might notice (but shouldn't affect you much).

1. tab completion
In bash, tab completion
bash> ls
# shows a list of files, then re-displays the command below:
bash> ls
# pressing again will re-display the list of files

In zsh, tab completion
zsh> ls
# shows list of files, but keeps the command displayed above the list. Pressing tab will cycle through all the possible completions

2. Wildcard matches
In bash, a missing wildcard match prints an error from the program you ran:
bash> ls *.aoeu
ls: *.aoeu: No such file or directory

In zsh, a missing wildcard match prints an error from the shell and never calls your program:
zsh> ls *.aoeu
zsh:1: no matches found: *.aoeu

posted by flicken at 2:34 AM on February 11, 2020 [1 favorite]

Tag on: anyone know why the heck they’d bother to change it, and why now?

I’ll probably just keep using bash, but I really can’t see any reason that makes sense, and it’s confusing .
posted by SaltySalticid at 5:01 AM on February 11, 2020

SaltySalticid: bash went GPLv3 and Apple haven't been updating tools goverened by that license. Rather than keep an ancient bash they are moving to a liberally licensed shell.
posted by adventureloop at 5:34 AM on February 11, 2020 [4 favorites]

flicken’s answer reminded me: The only thing that messed me up is that wildcards work different remotely.

> scp remote-machine:~/*.csv .

This doesn’t work despite having CSV files in my remote home directory— it’s rendering the wildcard locally. If you want to do what I was trying to do you need to escape the * as \*

Otherwise I love it (switched over several years ago) and highly recommend ohmyzsh
posted by supercres at 5:39 AM on February 11, 2020 [1 favorite]

I found this series of articles to be very useful when I was managing the switch last summer.
posted by Kwine at 5:56 AM on February 11, 2020 [2 favorites]

As an old & lazy person, I type "bash" into any terminal that looks strange. There's no reason not to launch a new shell every time. (How you make that happen automatically on a Mac I don't know. But, I'm sure it's possible.)
posted by eotvos at 7:02 AM on February 11, 2020 [2 favorites]

One other thing that may happen is that if you cut and paste some terminal command you found online, it might not work, but you could start bash and then run your command. Just type bash and hit return and you are back to the old way.
posted by advicepig at 7:17 AM on February 11, 2020 [1 favorite]

If you have never found yourself in a situation where you were legit enraged at one of bash's historical 'quirks' while you were in a hurry and it's 3AM, then you are unlikely to even notice the change. Other shells just have, like, different quirks.

A quick google search leads me to believe that switching back to bash is pretty painless (which is as I'd expect because unix), so the downside, if you find you hate it, is pretty short.
posted by Horkus at 1:14 PM on February 11, 2020 [1 favorite]

I switching back to bash is pretty painless Yes this bears repeating! You don’t have to change just bc Apple decided to change default behavior.

You get to do what you want, that’s a big feature of the OSX/*nix environment.
posted by SaltySalticid at 4:55 PM on February 11, 2020

« Older Korean meaning of in-law joke in Parasite?   |   Button down shirts. Plus size. Chicago. Physical... Newer »
This thread is closed to new comments.