Introduction

Antibody is a shell plugin manager made from the ground up thinking about performance.

It is faster because it can do things concurrently, while Antigen does it sequentially. It also has the advantage of using a compiled language instead of a scripting one.

You can see it working in the bellow:

How much faster?

Let’s see how much faster antibody is over antigen:

Data from getantibody/speed repository.

Make it even faster

Antibody is faster than other zsh package managers, but you might want to speed it up further.

Highly recommended to read the following:

Compatibility

Since antibody started as a subset clone of antigen, one might wonder how compatible one is with another. Let’s take a look.

Antibody can only bundle and update plugins. The apply command is not needed because running antibody bundle will already download and apply the given plugin.

The theme command is not implemented. You can just use bundle instead.

oh-my-zsh plugins are supported by using the folder annotation:

antibody bundle robbyrussell/oh-my-zsh folder:plugins/aws

Install

Antibody can be installed through a variety of sources.

The simplest way is to run:

curl -sL git.io/antibody | sh -s

This will put the binary in /usr/local/bin/antibody

You can also use homebrew (on macOS):

brew install getantibody/tap/antibody

Or even using AUR on Arch Linux.

You can also always download and install manually via tar.gz archives or using dpkg and our deb archives. Just head to the releases page and chose your poison.

Usage

There are mainly two ways of using antibody: static and dynamic. We will also see how we can keep a plugins file.

Plugins file

A plugin file is basically any text file that has one plugin per line.

In our examples, let’s assume we have a ~/.zsh_plugins.txt with these contents:

caarlos0/jvm
djui/alias-tips
# comments are supported like this
caarlos0/zsh-mkc
zsh-users/zsh-completions
caarlos0/zsh-open-github-pr

# empty lines are skipped

# annotations are also allowed:
robbyrussell/oh-my-zsh folder:plugins/aws

zsh-users/zsh-syntax-highlighting
zsh-users/zsh-history-substring-search

That being said, let’s look how can we load them!

Dynamic loading

This is the most common way. Basically, every time the a new shell starts, antibody will apply the plugins given to it.

For this to work, antibody needs to be wrapped into your ~/.zshrc. To do that, run:

# ~/.zshrc
source <(antibody init)

And reload your current shell or open a new one.

Then, you will also need to tell antibody which plugins to bundle. This can also be done in the ~/.zshrc file:

# ~/.zshrc
antibody bundle < ~/.zsh_plugins.txt

Static loading

This is the faster alternative. Basically, you’ll run antibody only when you change your plugins, and then you can just load the “static” plugins file.

Note that in this case, we should not put antibody init on our ~/.zshrc. If you did that already, remove it from your ~/.zshrc and start a fresh terminal session.

Assuming the same ~/.zsh_plugins.txt as before, we can run:

antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh

At any time to update our ~/.zsh_plugins.sh file. Now, we just need to source that file on ~/.zshrc:

# ~/.zshrc
source ~/.zsh_plugins.sh

And that’s it!

Options

There are a few options you can use that should cover most common use cases. Let’s take a look!

Kind

The kind annotation can be used to determine how a bundle should be treated.

The default is kind:zsh, which will look for files that match these globs:

  • *.plugin.zsh
  • *.zsh
  • *.sh
  • *.zsh-theme

And source them.

Example:

$ antibody bundle caarlos0/jvm kind:zsh
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-caarlos0-SLASH-jvm/jvm.plugin.zsh

The kind:path mode will just put the plugin folder in your $PATH.

Example:

$ antibody bundle caarlos0/ports kind:path
export PATH="/Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-caarlos0-SLASH-ports:$PATH"

Branch

You can also specify a branch to download, if you don’t want the master branch for whatever reason.

Example:

$ antibody bundle caarlos0/jvm branch:v2
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-caarlos0-SLASH-jvm/jvm.plugin.zsh

Sub-folders

You may specify a subfolder if the repo you are bundling contains multiple plugins.

Example:

$ antibody bundle robbyrussell/oh-my-zsh folder:plugins/aws
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws/aws.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws )

If you want multiple folders from the same plugin, you can just repeat the plugin with a different folder option:

$ antibody bundle "robbyrussell/oh-my-zsh folder:plugins/aws
  robbyrussell/oh-my-zsh folder:plugins/asdf"
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws/aws.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws )
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/asdf/asdf.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/asdf )

Outro

Let’s look what other commands antibody has available for us!

Update

Antibody can update all bundles in a single pass.

Just run:

$ antibody update
Updating all bundles in /Users/carlos/Library/Caches/antibody...

and that’s it.

Purge

You can remove a bundle completely by purging it:

$ antibody purge robbyrussell/oh-my-zsh
Removing robbyrussell/oh-my-zsh...

List

If you want to see what plugins you have in your home folder, you can of course list them:

$ antibody list
https://github.com/Tarrasch/zsh-bd            /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-Tarrasch-SLASH-zsh-bd
https://github.com/caarlos0/git-add-remote    /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-caarlos0-SLASH-git-add-remote
# ...

Home

You can also see where antibody is keeping the plugins with the home command:

$ antibody home
/Users/carlos/Library/Caches/antibody

Of course, you can remove the entire thing with:

rm -rf `antibody home`

if you decide to start fresh or to use something else.