zsh on os x

hexley

Configuring zsh for OS X

Download everything as an OS X application installer
by clicking on the box,

download zsh-templates installer

or install the files manually from one tarball: zsh-templates-0.9.9.tgz

Complete file listing: Click here to see a graphical view of the hierarchy

man pages (formatted and as html) for many of the functions are now available


WTF is this?

zsh is one of the unix shells that comes with OS X.  I've written  a few comments about why you might want to make zsh your default user shell. Briefly, it is most like ksh, the user-unfrienly but powerful shell prefered by serious shell programmers, except that it is in fact the most user-friendly and powerful interactive shell. In other words, it is simply better than everything else. zsh is to the other unix shells what OS X is to other operating systems. If you appreciate OS X, it is likely you will appreciate what zsh has to offer.

zsh works straight out of the box.  If you want to be a zsh user, simply issue the command

chsh -s /bin/zsh

and you are now a fully qualified zsh user with all rights and privileges. There is really nothing more to it than that.

However, you are denying yourself the full user experience if you don't customize your shell to enhance your working habits and productivity. To give you a starting point, you can install this package and it will automatically set up many features in such a way that it will facilitate customization. We have tried to pick default behaviors that almost anyone would find useful, but have also tried to build in as much flexibility as possible.

The best way to see what is available is to browse the  on-line documentation and man pages.

Highlights include:
  • An augmented open command that opens applications, widgets, preference panes and more.

  • An enhanced completion system for the "open -a" command with launchd-based real-time cache updating.

  • An enhanced completion system for the "fink" command with launchd-based real-time cache updating.

  • A set of functions (eg add_user) to create users, groups, etc.

  • A set of functions (cdf, fdc, posd, ...) to enhance Terminal-Finder Interactions.

  • A highly configurable edit fuction.

  • Functions for NFS (exportfs and nfs_niloader).

  • A function to assist customizing X11

  • A terminal-GUI interaction function, gdirs, to access a global directory stack for all shells, and a corresponding command-line option, cd?

  • A terminal-GUI to aid the user in switching customized prompts.

  • A command-line function, switch_users, for fast user switching.

  • A command, sss, to start the screen saver (and lock the screen if this has been set up).

  • Two GUI-assested setup scripts for customizing ssh completions, user_setup and host_setup.

  • Many additional customization features.

  • A specialized set of functions useful for X-ray crystallographers (not activated by default).




These files were originally based upon those distributed by Gary Kerbaugh, but I have made many additions and deleted or commented out a few things as well.  Overall, this is mostly a superset of Gary's files, along with contributions from several others. I've also tried to make these completely universal and easily configurable.  zsh is about customizing the user environment, so these files should be regarded as a starting point for tailoring zsh to your own needs. I have tried to facilitate this by comments throughout the files and by providing the documentation below.


1.  File organization and hierarchy:

Complete file listing:
Click here to see a graphical view of the hierarchy generated by Apache in real-time (so it will always be up to date).

By default, when zsh starts up, it reads the configuration files in /etc first, followed by those in the user's home directory.  You can make any of these files source any other file on your computer, so we take advantage of that to make things as modular and as configurable as possible.  There are two files to place in /etc.  These are /etc/zshenv and /etc/zshrc, and they are read in that order.  These in turn read files that are to be placed in /Library/init/zsh, which is where Apple suggests putting such things. 
[The main difference between the two files in /etc is that /etc/zshenv gets run any time you start up zsh, whereas /etc/zshrc gets run only when you start up an interactive shell.  (Gary's version only uses .zshenv, and his files are a bit different.)]

Here is a man page that I wrote to describe this package called zsh-templates.  The individual files are described in detail, and the links lead to the actual files and their man pages (which I have been updating and improving on a fairly frequent basis).


2. Setting up and general use:


Download the package installer by clicking on the box at the top of the page. Then run the installer. (Alternatively, you can everything manually from one tarball: zsh-templates-0.9.9.tgz). and install it following these simple directions, or Install with Fink ( Fink package described here.)




Back to zsh on OS X page

 Click here for web site index

Valid XHTML 1.0!