website/content/en/docs/config/plugin/cli.md
Warning Support for CLI plugins is experimental
| ⚡ Requirement | Lima >= 2.0 |
|---|
Lima supports a plugin-like command aliasing system similar to git, kubectl, and docker. When you run a limactl command that doesn't exist, Lima will automatically look for an external program named limactl-<command> in your system's PATH and additional directories.
Lima discovers plugins by scanning for executables named limactl-<plugin-name> in the following locations:
limactl binary (including symlink support)$PATH environment variable<PREFIX>/libexec/lima - For plugins installed by package managers or distribution packagesPlugin discovery respects symlinks, ensuring that even if limactl is installed via Homebrew and points to a symlink, all plugins are correctly discovered.
Available plugins are automatically displayed in:
limactl --help - Shows all discovered plugins with descriptions in an "Available Plugins (Experimental)" sectionAvailable Plugins (Experimental):
ps Sample limactl-ps alias that shows running instances
sh
limactl info - Includes plugin information in the JSON output{
"plugins": [
{
"name": "ps",
"path": "/opt/homebrew/bin/limactl-ps"
},
{
"name": "sh",
"path": "/opt/homebrew/bin/limactl-sh"
}
]
}
Lima extracts plugin descriptions from script comments using the <limactl-desc> format. Include a description comment in your plugin script:
#!/bin/sh
# <limactl-desc>Docker wrapper that connects to Docker daemon running in Lima instance</limactl-desc>
set -eu
# Rest of your script...
Format Requirements:
#!) are treated as scripts, and their <limactl-desc> lines will be extracted as the plugin description i.e Must contain exactly <limactl-desc>Description text</limactl-desc>Limitations:
<limactl-desc> comment is found in a script, the plugin will appear in the help output without a descriptionTo create a custom alias, create an executable script with the name limactl-<alias> and place it somewhere in your PATH.
Example: Creating a ps alias for listing instances
Create a script called limactl-ps:
#!/bin/sh
# Show instances in a compact format
limactl list --format table "$@"
Make it executable and place it in your PATH:
chmod +x limactl-ps
sudo mv limactl-ps /usr/local/bin/
Now you can use it:
limactl ps # Shows instances in table format
limactl ps --quiet # Shows only instance names
Example: Creating an sh alias
#!/bin/sh
# limactl-sh - Connect to an instance shell
limactl shell "$@"
After creating this alias:
limactl sh default # Equivalent to: limactl shell default
limactl sh myinstance bash # Equivalent to: limactl shell myinstance bash
limactl <unknown-command>, Lima first tries to find a built-in commandThis system allows you to:
libexec/lima directoryDistribution packages and package managers can install plugins in <PREFIX>/libexec/lima/ where <PREFIX> is typically /usr/local or /opt/homebrew. This allows plugins to be:
$PATHExperimental Feature: The CLI plugin system is currently experimental and may change in future versions. Breaking changes to the plugin API or discovery mechanism may occur without notice.