What is zsh equivalent of bash_profile?
I posted a more narrowly scoped question on Unix & Linux and got some clarification on how these files "work." Here's the summary of that answer and what I've learned in my research as to what, in my opinion should be used in a ZSH environment on a Mac.
For an excellent, in-depth explanation of what these files do, see What should/shouldn't go in .zshenv, .zshrc, .zlogin, .zprofile, on Unix/Linux.
Apple does things a little differently so it's best to be aware of this. Specifically, Terminal initially opens both a login and interactive shell even though you don't authenticate (enter login credentials). However, any subsequent shells that are opened are only interactive.
You can test this out by putting an alias or setting a variable in .zprofile, then opening Terminal and seeing if that variable/alias exists. Then open another shell (type zsh); that variable won't be accessible anymore.
SSH sessions are login and interactive so they'll behave just like your initial Terminal session and read both .zprofile and .zshrc
This is the order in which these files get read. Keep in mind that it reads first from the system-wide file (i.e. /etc/zshenv) then from the file in your home directory (~/.zshenv) as it goes through the following order.
.zshenv → .zprofile → .zshrc → .zlogin → .zlogout
1 A login shell is simply a shell, whether local or remote, that allows a user to authenticate to the system. These shells are typically interactive shells.
2 In interactive mode, they accept input typed from the keyboard. (GNU Bash Reference Manual, 1.2 What is a Shell?)
bash_profile is a configuration file for bash shell. When bash is invoked as an interactive login shell it first reads and executes commands from:
The idea is to share best practices, suggestions, tricks and keep the same profile across multiple development platforms easily cloning from the repository.
A typical install of OSX won't create a .bash_profile for you. When you want to run functions from your command line, this is a must-have.
Apple has changed the default shell to zsh. Therefore you have to rename your configuration files: .bashrc is now .zshrc and .bash_profile is now .zprofile.
You can use it with or without Catalina+ OSX, and also in combination of the normal terminal.
In order to enable a theme, set ZSH_THEME to the name of the theme in your: ~/.zshrc (open ~/.zshrc). Then edit the: ZSH_THEME="robbyrussell" based on any theme from: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes then: reload .zshrc:
Choose from the list: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins add the plugin to your plugins array in ~/.zshrc (SHIFT, cmd, .) view all files there, paste plugin into plugin folder. Standard plugins can be found in $ZSH/plugins/
More Questions
- Could you suggest How can i lower blood pressure??
- when did ernie davis die?
- How to present an abg?
- Amazon dynamodb vs redshift?
- How to contact tandem diabetes?
- How to be a intelligent boy?
- How to do glacier national park?
- why cps does nothing?
- what is ios account manager?
- What do i do if nitrofurantoin doesn't work?