WTF is this?

From OS X Scientific Computing

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


A Brief Guide to my ZSH on OSX Templates

Detailed Description

man zsh-templates 

to get the gory details.

This explains the whole file system and logic behind it. There is also an incomplete list of the functions.

You can also browse the html-formatted man pages for the most up to date information on the individual functions.

A Quick Overview

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 highly configurable edit fuction.

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

  • 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).

  • 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.

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. By starting zsh with the command

/bin/zsh -f

You avoid reading /etc/zshrc and everything sourced from it.

Almost everything, therefore, apart from the system $PATH, really should be sourced from /etc/zshrc, so we do that.

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).

Installing customization templates

Please go to my ZSH on OS X: Installing customization templates wiki page.

Exhaustive Description

I'm coming to the realization that it would be useful to have a concise but comprehensive description of each file in the package and what its purpose is, and what the default settings all mean, and of course how best to change them. This is going to be a monumental undertaking, but I have to start somewhere. The individual functions are documented in the man pages and html-ized man pages. But the need for one-stop shopping for all your zsh template needs is clear. Thus I'll be constructing a new wiki section called

Explanations for each zsh template file

Return to ZSH on OS X.
Personal tools