how to get bash and zsh setup correctly on macOS mojave

0

I'm running macOS (Mojave.)

I'm wanting to make the switch from default bash to zsh/oh-my-zsh.

Everything I install assumes I'm going to be editing my .bash_profile (or .bashrc.) I'm not 100% on how to interperet this; do I replace .bash_profile with .zshrc?

Honeslty the subject of .bash_profile, .bashrc, .profile, .zshrc is a sourse of stress for me as a junior superuser/sysadmin.

I could use some advice on how to get .bash_profile, .basrc, .profile, .zshrc, etc. setup correctly.

user7314150

Posted 2019-08-18T18:58:27.343

Reputation: 1

Zsh/Bash startup files loading order (.bashrc, .zshrc etc.) | The Lumber Room has all the info you need regarding the startup files. – DavidPostill – 2019-08-18T20:05:14.503

Answers

0

For smooth migration from Bash to ZSH. Copy ~/.bashrc as ~/.zshrc. You may need to merge the contents if there's one ~/.zshrc already.

Simba

Posted 2019-08-18T18:58:27.343

Reputation: 756

0

You can copy your .bash_profile contents to .zshrc. They should be compatible.

I'd recommend installing the latest zsh via Brew. Then installing the following via Brew to enhance zsh:

Follow the instructions from the Brew CLI output on how to load these enhancements at login.

Before fully committing to zsh, you can use iTerm2 to configure a profile for Bash and another profile for zsh until you're fully comfortable with the new shell.

If you're coming from Bash, some paths are loaded from /etc/paths.d/. So for example if you're using iTerm2 to load zsh by command: /usr/local/bin/zsh, for some weird reason /etc/zprofile & therefore /etc/paths.d/ are not loaded. To fix this just change the command to /usr/local/bin/zsh -l so that zsh loads as a login shell.

Here's a better explanation why the default zsh session is not a login session.

j7an

Posted 2019-08-18T18:58:27.343

Reputation: 1