How to use Oh My Zsh to manage your Kamal server

Oh My Zsh is a nice productivity addition to the Z shell for your Mac. If you are using Kamal, you can now use a Kamal plugin to make your deployments more fun.

Table of contents

Oh My Zsh

Oh My Zsh is a popular open-source framework for managing Zsh configurations. It provides a wide range of plugins, themes, and features that enhance the Zsh shell experience for users. The project's repository serves as the central hub for the community to contribute to and collaborate on the development of Oh My Zsh and its plugins.

It was made to simplify Zsh configuration management and improve your productivity when using the terminal. One of the best things of Oh My Zsh is the plugin architecture that let's you install hundreds of powerful plugins for all kinds of tools you are already using as well as bunch of beautiful themes.

Installation

Zsh is a default shell on macOS so I assume you are already using it.

To install Oh My Zsh, run the following command in your terminal:

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

This command will download and run the Oh My Zsh installation script. Follow the prompts during the installation process.

Once done, you should see a similar welcome message:

Found /Users/cupofjoe/.zshrc. Backing up to /Users/cupofjoe/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to /Users/cupofjoe/.zshrc.

         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/                       ....is now installed!


Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.

• Follow us on X: @ohmyzsh
• Join our Discord community: Discord server
• Get stickers, t-shirts, coffee mugs and more: Planet Argon Shop

➜  ib git:(master)

If necessary, restart your terminal for the changes to take effect. You can also further customize everything it by editing the ~.zshrc file.

Kamal plugin

One of the powerful plugins for Oh My Zsh is the new Kamal plugin contributed by Igor Aleksandrov. This plugin will make using Kamal much more pleasant by these two improvements:

  1. Autocomplete Support: Autocomplete functionality has been added for Kamal commands and sub-commands. This feature aims to improve user experience by providing suggestions and completing commands efficiently.

  2. Aliases: An alias kad has been introduced for the kamal deploy command. This alias, standing for 'KAmal Deploy,' offers users a convenient shortcut for deploying applications to servers. The inspiration comes from the widely used Capistrano cap command in Ruby.

Installation

To install the Kamal plugin in Oh My Zsh, you add it to the list of active plugins and reload the shell.

  1. Edit your ~/.zshrc file to enable the Kamal plugin. Find the plugins line and add kamal to the list of plugins:

    plugins=(... kamal)
        
  2. Save the changes and source your ~/.zshrc file to apply the plugin configuration:

    source ~/.zshrc
        

You should now see the autocomplete support as well as the new alias for the kamal deploy command.

Note that this will only work once this support is merged and until then you also need to merge this yourself in your fork or use the branch from the PR.

Author
Josef Strzibny
I am a full stack web developer with love for Linux. I made and deployed my first commercial web applications during high school in 2008. I have worked for Red Hat on the platform and developer experience teams as a Linux packager.

© Deploy Linux Blog