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 below example:
Let’s see how much faster antibody is over antigen:
Data from getantibody/speed repository.
Antibody is faster than other zsh package managers, but you might want to speed it up further.
Highly recommended to read the following:
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 path
annotation:
antibody bundle ohmyzsh/ohmyzsh path:plugins/aws
Antibody can be installed through a variety of sources.
The simplest way is to run:
curl -sfL git.io/antibody | sh -s - -b /usr/local/bin
This will put the binary in /usr/local/bin/antibody
You can also use homebrew (on macOS):
brew install 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.
There are mainly two ways of using antibody: static and dynamic. We will also see how we can keep a 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:
ohmyzsh/ohmyzsh path:plugins/aws
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-history-substring-search
That being said, let’s look how can we load them!
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
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!
If you use CleanMyMac or similar tools, make sure to set it up to ignore the
antibody home
folder, otherwise it may delete your plugins.
You may also change Antibody’s home folder, for example:
export ANTIBODY_HOME=~/Libary/antibody
There are a few options you can use that should cover most common use cases. Let’s take a look!
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"
The kind:fpath
only puts the plugin folder on the fpath
, doing nothing else.
It can be specially useful for completion scripts that won’t allow to be
sourced.
Example:
$ antibody bundle Linuxbrew/brew path:completions/zsh kind:fpath
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-Linuxbrew-SLASH-brew/completions/zsh )
The kind:clone
only gets the plugin, doing nothing else. It can be useful for
managing a package that isn’t directly used as a shell plugin.
Example:
$ antibody bundle mbadolato/iTerm2-Color-Schemes kind:clone
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
You may specify a subfolder or a specific file if the repo you are bundling contains multiple plugins.
Example:
$ antibody bundle ohmyzsh/ohmyzsh path:plugins/aws
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/aws/aws.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/aws )
If you want multiple paths within from the same plugin, you can just repeat the
plugin with a different path
option:
$ antibody bundle "ohmyzsh/ohmyzsh path:plugins/aws/aws.plugin.zsh
ohmyzsh/ohmyzsh path:plugins/asdf"
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/aws/aws.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/aws )
source /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/asdf/asdf.plugin.zsh
fpath+=( /Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh/plugins/asdf )
Let’s look what other commands antibody has available for us!
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.
You can remove a bundle completely by purging it:
$ antibody purge ohmyzsh/ohmyzsh
Removing ohmyzsh/ohmyzsh...
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
# ...
You can see the path being used for a cloned bundle.
$ antibody path ohmyzsh/ohmyzsh
/Users/carlos/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh
This is particularly useful for projects like oh-my-zsh that rely on
storing its path in the $ZSH
environment variable:
$ ZSH=$(antibody path ohmyzsh/ohmyzsh)
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.
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code.