Rick Cogley's Tech Logr

Short Technical Laser Bursts %%

RC Logr 20190325 150523

Monday, 25 Mar, 2019

The zsh that is installed by default on macOS is 3 years old, but you can use homebrew to install the latest. Add the brew installed one to your shells whitelist, and set your login shell to it using chsh. Use the prefix switch on brew to find the path of the shell you installed. 🤓

$> brew install zsh zsh-completions
$> sudo echo $(brew --prefix zsh) >> /etc/shells
$> cat /etc/shells
$> chsh -s $(brew --prefix zsh)
$> sudo dscl localhost -read /Local/Default/Users/$(whoami) shell
$> echo $SHELL

Using brew --prefix zsh to find the path of the brew-installed zsh is the most precise, but you may know about whereis or which as well. Bonus trivia - whereis zsh will return the original macOS one since it does not look in your path, whereas, which zsh does look in your path and will find the one installed by brew (try also which -a zsh to see them all).

The above dscl command will reliably return your user shell, but you can confirm your settings in the GUI too. Just ctrl-click on your user in System Prefs, Users and Groups, and select Advanced Options. The echo $SHELL shows the shell at login, but may be misleading because the act of changing shells will not update it.

Update: Rudi mentions that it might work to set the history file’s perms to 700 or the like; a valid point. However, the man file bash shell builtins says the file that source is executing “need not be executable”.

RC Logr 20190325 150523 - The zsh that is installed by … Rick Cogley
Back to Home Tweet Link