ZSH on OS X: Installing customization templates

From OS X Scientific Computing

Jump to: navigation, search
Return to ZSH on OS X.

Contents




Make zsh your default user shell

To use zsh, all you need to do is issue the following command.

chsh -s /bin/zsh

For more details and other options, see Make zsh your default user shell

Download and Installation

zsh_google.png

  • Read about what is new in the New Release!
  • You can now install systemwide (as described below) or in your home directory (see the above link).
  • Works on Linux now, too.


  1. If you currently have files in /etc/zshrc and /etc/zshenv and /Library/init/zsh, you may want to back these up first and/or delete them.
  2. Download the files as one tarball: zsh-templates-1.x.y.tgz from the link on the New Release page.
  3. Unpack this tarball to obtain the directory zsh-templates-1.x.y
  4. Assuming this directory now resides on your desktop, please issue the following commands:
cd ~/Desktop/zsh-templates-1.x.y
ls

and you will see three directories listed:

Applications/   Library/        etc/

Installing the Required Files

Two sets of files are required, and there are some optional ones you may wish to install as well.

The files that go into /etc

The first set of required files will be /etc/zshenv and /etc/zshrc. These are the "master" files that the /bin/zsh binary is hard-wired to look for. These are read, and they will tell zsh about all of the other files, so you need to install both of these. Install them like this:

cd ~/Desktop/zsh-templates-1.x.y/etc
sudo cp zshenv zshrc /etc/.

Please make sure any previously existing /etc/zshenv or /etc/zshrc files have been moved out of the way before you do this.

I've tried to make these as general as possible so that you will not have to edit their content. If you are forced to change something, please contact me with the change so I can incorporate the improvement.

The files that go into /Library/init/zsh

Apple suggests installing shell configuration scripts in /Library/init or in ~/Library/init. The files you install in these directories will not be read by zsh unless /etc/zshenv and /etc/zshrc point to these directories, so you have to do the first step of this installation in order for this second step to work. To install the remainder of the required files, please do the following:

sudo mkdir -p /Library/init
cd ~/Desktop/zsh-templates-2.x.y/Library/init
sudo cp -R zsh /Library/init/.

Please make sure any previously existing /Library/init/zsh has been moved out of the way before you do this.

Alternative Install for Individual Users

If you do not want to install the zsh-templates for everyone on the system, you now have the option of installing them as an individual user.

Briefly, the files /etc/zshenv and /etc/zshrc can instead be installed as ~/.zshenv and ~/.zshrc, and the files that go into /Library/init can instead go into ~/Library/init. (Don't try to mix individual user and system installs. Either install everything in the system directories, or everything in only the user directories.)

More details are given on the New Release page.

Installing the Optional Files

There are some other files you might be interested in installing that come in the package. You don't need to do this, but you might like to play around with these additions. These supplemental items are subdivided into two sets:

Applications

You can take a look at what is in the Applications subdirectories:

/Applications/zsh-templates_extras
    Finder_Toolbar_Icons
       README
       iTerm.webloc
       iterm_cdf_zsh.app
       terminal_cdf_zsh.term
       Xtal
           Xtal_apps.dmg.bz2

Unless you do X-ray crystallography, you won't want the "Xtal_apps", but you might like the Finder Toolbar Icons

LaunchAgents

The Library/LaunchAgents directory contains these three files:

Library/LaunchAgents.disabled/zsh.fink.completion.plist
Library/LaunchAgents.disabled/zsh.open.completion.plist
Library/LaunchAgents.disabled/zsh.refresh.completion.plist


I made these to try to speed up the command-line completion system for the fink command as well as the OS X open command.

You can install them by putting them into either /Library/LaunchAgents or perhaps you might be better off putting them into ~/Library/LaunchAgents

They should be considered alpha-level additions, and you may encounter problems in a multi-user environment if you place these into /Library/LaunchAgents. If so, just remove them and the problem (usually whining in the log files) is gone on the next restart.

Installing from SVN

If you want to keep very up-to-date, you can easily install and access my svn repository on the zsh google-code svn site.

zsh_google.png


Return to ZSH on OS X.
Personal tools