
Use zsh as the default shell on your Mac - jhack
https://support.apple.com/en-ca/HT208050
======
Newtonip
For those wondering why Apple is allergic to GPLv3 code: there is a clause in
the license requiring you provide a way to run modified version of the
software which would require Apple to let users self sign executables.

~~~
AaronFriel
So, Homebrew?

You can't tell me that Microsoft is able to ship entire distribution's
userlands (Debian, Ubuntu, SUSE, and more) through the Windows Store,
including all their GPL3 components, and Apple can't figure out how to ship an
updated version of base64.

If I'm grumbling, it's just because making devops/CI scripts work on Windows
and Linux is easier than MacOS and Linux these days because my colleagues run
into issues like "base64" or "uuidgen" having different arguments in the
extremely dated MacOS userland, and they then have to brew install a bunch of
isolated components.

~~~
m_mueller
I've moved on to Windows since last year. Besides terminal emulators being
shit (which they're fixing now), worse PDF support and shit OS config
management, there's really not much anymore that goes in favor of Macs. Their
laptops are worthless junk at 40% markup, the OS gets buggier and more locked
down with every version while Windows is on a clear trajectory of improvement
and PC hardware gives real choice and innovative solutions. I was a Mac user
for 13 years, but no more. Since they gave all the keys to Jony it went down
the drain real fast.

~~~
skykooler
My biggest problem with Windows is that you can't scroll in a window or a pane
without clicking on it first. Both Mac and Linux support that and it makes the
OS feel so clunky.

~~~
eMSF
That's actually one of the better new features in Windows 10 (that you can
these days scroll an inactive window).

~~~
skykooler
Oh, really? I might give it a try again one of these days, then.

~~~
mcv
I'm no Windows fan, but Windows 10 is the first where I don't actively hate
the window manager. Well, I do hate how it keeps moving all my windows to the
left side of the desktop. Not sure why that is happening. So I guess I hate
something different about it now.

~~~
m_mueller
You mean it's snapping to the left half after some action? That would probably
be when you press Windows+Left-Arrow, happens to me sometimes when I try to do
Ctrl-left for example.

~~~
mcv
It's generally when I unlock the screen after waking up. I have no idea if I
accidentally pressed Windows+Left, but it's doing this very consistently.

~~~
m_mueller
sounds a bit like a driver issue, like it changes the screen resolution during
wake-up. you should figure out whether it's the exact size used for half-pane
snapping (which sounds like userland issue), or whether it's some other size.

~~~
mcv
I don't think it's the size for 'half-pane snapping'. It seems a faulty screen
resolution change on wake-up might indeed be my problem.

------
reilly3000
zsh is the default shell on all of my machines because I make it so. I think
the tab completions that ohmyzsh provides have saved me on the order of 40 hrs
/ year, and helped me learn new APIs much easier, since you can see all
options without the --help.

If you haven't tried it, I cannot recommend zsh + plugins enough. Only install
that you actually use, otherwise it can slow start time a bunch.

Here is a list of the plugins that are available:
[https://github.com/robbyrussell/oh-my-
zsh/wiki/Plugins](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins)

I especially appreciate git+git-extras, web-search (`google my query`),
docker, npm, and dirhistory.

~~~
farisjarrah
Shout out to the fish shell which can do all the fancy syntax highlighting and
show command options out the box with no plugins

~~~
geowwy
I used fish for a while. It was nice but way too many compatibility issues.
Zsh is a nice compromise.

~~~
kurtisc
IMO compatibility issues are the result of conflating a CLI with a scripting
language. If a script was written for bash, run it with bash, not fish or zsh.
I can withstand having two shells installed.

~~~
CGamesPlay
You can, but if Fish's value proposition is ease-of-use, then people who can't
withstand that need to be able to use fish easily still. Not being able to run
`PORT=5000 yarn start` or `make && ./a.out` or whatever snippet you copy-paste
from the web without understanding are going to be a big pain point for
newcomers to fish.

Don't get me wrong, I'm a happy fish user myself. But breaking backwards
compatibility with shells from the past 40 years and then saying "you're doing
it wrong" is not how to make easy-to-use software.

~~~
kevinherron
Fish 3.0 addresses the common `&&` and `||` operator incompatibility and if
you pasted the first snippet it suggests that you should use `env`:

fish: Unsupported use of '='. To run 'yarn' with a modified environment,
please use 'env PORT=5000 yarn…'

------
jlawer
Guess they had to go somewhere as Apple's unwillingness to have GPLv3 code
effectively killed off bash updates.

Slightly disappointed, but guess they had to go somewhere and zsh is going to
be well supported going forward

~~~
bayareanative
???

    
    
        # change default shell to newer brew'ed bash
        brew install bash && sudo dscl . change /users/$USER UserShell /bin/bash /usr/local/bin/bash
    
        # change default shell to newer brew'ed zsh
        brew install zsh && sudo dscl . change /users/$USER UserShell /bin/bash /usr/local/bin/zsh

~~~
TylerE
What's your ???

That's homebrew, not Apple.

~~~
bayareanative
So? Apple doesn't ship updated packages. It never did. If you want updates,
you use a package manager, not Apple's ancient crap. That's life.

~~~
javagram
Apple stopped shipping updated packages because bash went GPLv3...

Since ZSH is under an MIT-like license, they’ll probably ship updates to it.

~~~
eridius
The version of /bin/zsh on macOS 10.14.5 is a little over 2 years old. This
means they have already been shipping updates to it. Now that it's the default
shell they'll probably ship updates a little more frequently (I don't have
Catalina installed but I'm guessing its version of zsh is newer than 5.3).

------
duskwuff
Ooh, and they're throwing in dash too!

> To test script compatibility with Bourne-compatible shells in macOS
> Catalina, you can change /var/select/sh to /bin/bash, /bin/dash, or
> /bin/zsh. If you change /var/select/sh to a shell other than bash, be aware
> that scripts that make use of bashisms may not work properly.

------
kccqzy
It's probably because the default bash is a very ancient version before FSF
transitioned to GPLv3. That said, I've been using zsh for a long time and this
is a great change.

------
tannhaeuser
While Apple is at modernizing their POSIX userland, they should also consider
other ancient software they're using. For example, last I looked on Apple's
Darwin Open Source site (about a year or two ago), they shipped a really old
and buggy awk (nawk) version.

~~~
jamil7
Can we get a modern python version while we're at it?

~~~
anentropic
tip: use pyenv instead

~~~
skohan
It feels so cludgy to me to have to use a tool like pyenv just to reliably
execute pyhthon code.

------
dontbenebby
I've never worked outside bash. I have a lot of simple bash scripts. (Usually
just stringing together commands with the occasional pipe or output to file)

Will this break all those or are bash scripts and zsh scripts basically
interchangeable?

~~~
okdana
As the other person said, if your scripts are executables with an sh or bash
'shebang' at the top, they will continue to use the same shell they always
did.

But if you _did_ want to run them with zsh, most simple scripts that just set
environment variables, string together commands, or redirect to files should
work without any changes. The most obvious difference for basic scripts like
that is that zsh doesn't split parameter-expansions on white space by default
(so if you did something like `opts='-a -b -c'; mycmd $opts` it wouldn't work
without additional, minor, modifications)

~~~
romka2
The minor modification would be from `$opts` to `$=opts`.

I'd been using ZSH for a year as if it was Bash with better history and much
better completions. The difference mentioned above was the only one I knew
about. I kept writing my scripts in Bash and was quite happy with the UX.

------
hestefisk
I still fondly remember when tcsh was the default shell. Like a real BSD Unix.

~~~
reaperducer
It's still in there. The linked article tells how to do it.

 _In Terminal, enter $ chsh -s path, where path is one of the shell paths
listed in /etc/shells, such as /bin/zsh, /bin/bash, /bin/csh, /bin/dash,
/bin/ksh, /bin/sh, or /bin/tcsh._

~~~
Cyberdog
And you can use MacPorts or (presumably) Homebrew to install newer versions of
tcsh or pretty much any other shell you might want.

I personally never stopped using tcsh after the bash switchover since it's
what I knew and what my dotfiles were already written in, and I'll most likely
just keep using it in Catalina too.

------
SomeOldThrow
I'm really surprised they went with zsh rather than fish. I guess they want to
preserve the ability for existing `source` scripts to work.

~~~
tptacek
Why would they use fish? Fish is nice and all, but zsh is a much more
mainstream shell.

~~~
SomeOldThrow
Since when is mainstream better? Why did they choose zsh? They don't justify
that either. It's just odd to pick one post-bash shell but not the other when
they have very similar feature sets—autocomplete, persistent global variables,
attention to end-user quality.

EDIT: apparently zsh doesn't have persistent or global variables, my bad.

~~~
spartanatreyu
There's already a lot of community support available for zsh.

Plenty of developers are using oh-my-zsh either for just the plugin support or
for the very popular iterm+powerlevel9k+agnoster theming.

~~~
romka2
Pro tip: s/powerlevel9k/powerlevel10k/. Same config, same theme, but much
faster.

------
yokohummer7
zsh is better than bash in nearly all aspects, at least in my use cases, so
this is a great news for me. Is there anything that can be done in bash but
not in zsh?

~~~
iguessthislldo
I've been using zsh on Linux for years (4 at least). I was creating a function
that I wanted to run in zsh and bash and I think I ran into some option that
was available on a builtin command in bash that wasn't on the zsh version. I
can't remember the details though, because it was a while ago. I imagine if
someone deals with shell scripts more regularly than I do they would run in to
those kind of problems more than me.

------
mmastrac
From 2012 - Apple's great GPL purge:
[https://news.ycombinator.com/item?id=3559990](https://news.ycombinator.com/item?id=3559990)

Short-sighted move considering Microsoft is actively looking to ship a Linux
kernel in Windows.

~~~
eridius
The Linux kernel is GPLv2. Apple still ships GPLv2 code, but they're highly
allergic to GPLv3 (as are most big companies).

------
rsynnott
Maybe I’m imagining things, but wasn’t zsh also the default until MacOS 10.4
or so?

Edit: I was misremembering things. tcsh until 10.3.

~~~
jasone
zsh was the default sh until OS X 10.2 or 10.3. However, the zsh version was
quite out of date (3.x when 4.x was already mature/stable, IIRC). A horse race
between the old zsh and the latest bash was jiggered to show bash as much
faster, and therefore worth switching to, never mind that the then-current zsh
demonstrated performance parity with bash.

Source: I was tasked with the performance comparison and (despite my
objections) the conversion to bash. On the bright side, I learned a lot about
zsh in the process and have used it as my shell rather than bash ever since.

------
samgranieri
Fantastic! Any time I get a new mac I install homebrew ZSH and edit
/etc/shells to add it in.

~~~
mikl
macOS already ships with zsh, and has done so for years, it’s just not the
default shell. Unless you want to always have the very latest version of zsh,
you don’t need to install it with homebrew.

------
dandigangi
Had no idea they were shipping zsh in newer versions. Neat! Wonder why they
don't do Bash 4.x.x+ versions by default. Or, do they?

~~~
Cyberdog
The main reason is issues with the GPLv3 license, as discussed elsewhere in
the comments.

------
youeseh
For the uninitiated: why is zsh better than bash?

~~~
latexr
The uninitiated won’t notice much of a difference, and that is bound to be the
point. Bash on macOS is stuck at version 3 due to licensing reasons (GPL3),
while ZSH is not (MIT).

~~~
bsimpson
For even more historical context, macOS originally shipped with tcsh. We've
already done the shell transition once, and basically nobody noticed.

~~~
koenigdavidmj
That wouldn’t have broken as much, since everyone’s scripts would have a bash
or sh shebang line on top. Changing what /bin/sh points to is a much riskier
change.

~~~
okdana
Is that what they've done? The linked article doesn't say that.

~~~
brirec

        $ /bin/sh --version
        GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
        Copyright (C) 2007 Free Software Foundation, Inc.

~~~
koenigdavidmj
You can change this by pointing /var/select/sh .

------
stunt
I use Fish. So not an exciting news for me.

~~~
AnthonBerg
I use Fish too :) And I haven't really connected with zsh. I've tried. However
I think this is good news for Fish too. It's the beginning of a long-overdue
un-Bashifying.

------
eeeeeeeeeeeee
I switched to ZSH a few years ago because some of my coworkers were using it.
I never found it useful enough to use it over Bash. So I switched back to
Bash. I’d rather have the shell be identical to the one running on the servers
I use.

------
paxys
As a happy zsh user, I'm glad that this will finally force every application
and software package in the world to stop assuming that bash is the default
(and only) shell.

------
latexr
Finally!

Though I will say I’m surprised. I’ve opened a radar suggesting this change
and it was closed with (paraphrasing) “won’t do it as the user can easily
change the shell, I myself do it”.

------
jhanschoo
I had trouble updating iTunes once because my shell was set to zsh, and it
took me quite a while to debug what went wrong. I recommend that when this
switchover occurs, users should temporarily switch to bash if they encounter
an installer that does not work.

------
fouc
I've noticed that sometimes there's oddities with zsh & homebrew or rvm that
force me to drop into bash in order to run a command. With apple standardizing
on zsh, that should finally resolve these bugs.

------
bojanz
zsh users, good time to try out my favorite prompt, Pure:
[https://github.com/sindresorhus/pure](https://github.com/sindresorhus/pure)

Nowadays that's the only thing I run on top of zsh, which makes the shell
significantly faster than with oh-my-zsh (and its kitchen sink).

------
geuis
I’m only familiar with working in bash and bash scripts. What do I need to
know about the differences with zsh?

------
pierreprinetti
oh crap. Yet another outdated package bolted into the OS.

------
caiob
Any beta testers here able to confirm whether Terminal.app supports True Color
now?

~~~
opk
Can't answer that but on a related note, recent zsh fully supports true color.
You could always use it in things like prompts with literal escape sequences
but it'll also work for syntax highlighting etc and interpret colours in hex
triplet form for you now.

