#
, since I don’t want to use that config, but I didn’t lose them. From line 28 to 73, it’s basically the configuration of the prompt. There are literally dozens of ways to configure the prompt, and you can see some of them here. Mine is quite similar to Falkor’s one, but I’ve edited it a little bit. You can find out more about how to stylizing your prompt and how the configuration variables work here and here.ZSH_THEME='powerlevel9k/powerlevel9k'
— and also the Powerlevel mode —line 35. The Powerlevel Mode define the type —or the style— of glyphs than are shown.zshconfig
./etc/shells
with atom:Cmd + ;
. In the General tap you can find which shell use terminal. Choose command and type /bin/bash
.brew cask install fontforge
— and modify those parameters to be equal to the original ones ↩zsh
.bash
settings, configurations, and scripts over to zsh
.zsh
Promptzsh
zsh
.zsh
as well, I am planning to document my process of transferring my personal bash
setup and learning the odds and ends of zsh
.zsh
customization, I feel this will actually prevent an understanding of how zsh
works and how it differs from bash
. So, I am planning to build my own configuration ‘by hand’ first.bash_profile
and cleaned it up. There were many aliases and functions which I do not use or broke in some macOS update. I the end, this is what I want to re-create in zsh
:open
files with a specific applicationbash
this is set in .inputrc
)zsh
configuration?bash
has a list of possible files that it tries in predefined order. I have the description in my post on the bash_profile
.zsh
also has a list of files it will execute at shell startup. The list of possible files is even longer, but somewhat more ordered.all users | user | login shell | interactive shell | scripts | Terminal.app |
---|---|---|---|---|---|
/etc/zshenv | .zshenv | √ | √ | √ | √ |
/etc/zprofile | .zprofile | √ | x | x | √ |
/etc/zshrc | .zshrc | √ | √ | x | √ |
/etc/zlogin | .zlogin | √ | x | x | √ |
/etc/zlogout | .zlogout | √ | x | x | √ |
/etc/
will be launched (when present) for all users. The .z*
files only for the individual user.zsh
will look in the root of the home directory for the user .z*
files, but this behavior can be changed by setting the ZDOTDIR
environment variable to another directory (e.g. ~/.zsh/
) where you can then group all user zsh
configuration in one place.ZDOTDIR
to ~/Documents/zsh/
and then use iCloud syncing (or a different file sync service) to have the same files on all your Macs. (I prefer to use git
.)bash
will either use .bash_profile
for login shells, or .bashrc
for interactive shells. That means, when you want to centralize configuration for all use cases, you need to source
your .bashrc
from .bash_profile
or vice versa.zsh
behaves differently. zsh
will run all of these files in the appropriate context (login shell, interactive shell) when they exist.zsh
will start with /etc/zshenv
, then the user’s .zshenv
. The zshenv
files are always used when they exist, even for scripts with the #!/bin/zsh
shebang. Since changes applied in the zshenv
will affect zsh
behavior in all contexts, you should you should be very cautious about changes applied here.zsh
will run /etc/zprofile
and .zprofile
. Then for interactive shells (and login shells) /etc/zshrc
and .zshrc
. Then, again, for login shells /etc/zlogin
and .zlogin
. Why are there two files for login shells? The zprofile
exists as an analog for bash
’s and sh
’s profile files, and zlogin
as an analog for ksh
login files.zlogout
files that can be used for cleanup, when a login shell exits. In this case, the user level .zlogout
is read first, then the central /etc/zlogout
. If the shell is terminated by an external process, these files might not be run./etc/zprofile
and /etc/zshrc
files. Both are very basic./etc/zprofile
uses /usr/libexec/path_helper
to set the default PATH
. Then /etc/zshrc
enables UTF–8 with setopt combiningchars
. Cs go unbalanced teams command./etc/bashrc
there is a line in /etc/zshrc
that would load /etc/zshrc_Apple_Terminal
if it existed. This is interesting as /etc/bashrc_Apple_Terminal
contains quite a lot of code to help bash
to communicate with the Terminal application. In particular bash
will send a signal to the Terminal on every new prompt to update the path and icon displayed in the Terminal window title bar, and provides other code relevant for saving and restoring Terminal sessions between application restarts./etc/zshrc_Apple_Terminal
and we will have to provide some of this functionality ourselves./etc/zshrc
in the macOS Catalina beta is different from the Mojave /etc/zshrc
and provides more configuration. However, since Catalina is still beta, I will focus these articles on Mojave and earlier. Once Catalina is released, I may update these articles or write a new one for Catalina, if necessary.ZDOTDIR
variable to change the location of the other zsh
configuration files, setting that variable in ~/.zshenv
seems like a good choice. Other than that, you probably want to avoid using the zshenv
files, since it will change settings for all invocations of zsh
, including scripts.zsh
will potentially run all configuration files..zshrc
.zsh
, such as ‘prezto’ or ‘oh-my-zsh’, will override or re-configure your .zshrc
. You could consider moving your code to .zlogin
instead. Since .zlogin
is sourced after.zshrc
it can override settings from .zshrc
. However, .zlogin
is only called for login shells.zsh
from another shell by typing the zsh
command..zshrc
file and if you want to use any of the theme projects, read and follow their instructions closely as to how you can preserve your configurations together with theirs.PATH
environment variable for third party tools. Often the third party tools in question will have elaborate postinstall scripts that attempt to modify the current user’s .bash_profile
or .bashrc
. Sometimes, these tools even consider that a user might have changed the default shell to something other than bash
.PATH
should be done by adding files to /etc/paths.d
.PATH
centrally, administrators should consider /etc/zshenv
or adding to the existing /etc/zshrc
. In these cases you should always monitor whether updates to macOS overwrite or change these files with new, modified files of their own.zsh
can load user configuration. You should use ~/.zshrc
for your personal configurations.zsh
for you. This is fine, but might keep you from really understanding how things work./etc/paths.d
and similar technologies or consider /etc/zshenv
or /etc/zshrc
.zsh
in Terminal is not as detailed as it is for bash
.