Skip to main content

Using shell plugins

If you’re using a non-interactive shell

1Password Shell Plugins are built to be used with interactive shells. An interactive shell is required for the shell plugin to prompt for authentication.

If your script doesn’t inherit shell plugin aliases

Scripts might not inherit your shell plugin aliases if they’re run in a subshell where the plugins.sh file isn’t sourced. When this happens, the CLI command in the script will output an error instead of running correctly. For example, the following script runs a doctl command in a subshell, and as a result wouldn’t inherit the doctl shell plugin alias:
yourscript.sh
#!/usr/bin/env bash

doctl account get
To make the script run correctly, you can wrap the doctl command in op plugin run. For example:
yourscript.sh
#!/usr/bin/env bash

op plugin run doctl account get

If autocompletion stops working

If autocompletion stops working in Zsh after you configure a shell plugin, run the following command to configure completion for aliases:
setopt completealiases

Contributing shell plugins

If your locally-built plugin stops working

If your locally-built plugin stops working, you might need to update your 1Password CLI version or rebuild your plugin with the latest shell plugins SDK.

Update your 1Password CLI installation

If you’re using an outdated version of the CLI, you’ll see this error message:
1Password CLI is outdated, please run:

	op update

to update 1Password CLI to the latest version and to be able to use
this Shell Plugin.
To update your 1Password CLI installation to the latest version:
op update
Or update 1Password CLI with a package manager.

Rebuild your plugins with the latest shell plugins SDK

If the shell plugins SDK is outdated, you’ll see this error message:
1Password Shell Plugin is out of date. Remove the plugin at
'/Users/<user>/.op/plugins/local/aws' or rebuild it with the
latest Shell Plugin SDK to use it.
To update to the latest shell plugins SDK, you’ll need to merge the main branch of the shell plugins repository into the branch for your plugin. To do this:
  1. Navigate to the directory where you cloned the shell plugins repo:
    cd <path/to/shell-plugins/repo>
    
  2. If you’ve made any local changes to your plugin branch, commit or stash them:
    git commit -am "<commit message>"
    
  3. Check out the main branch:
    git checkout main
    
  4. Pull the main branch:
    git pull main
    
  5. Check out your plugin branch:
    git checkout <your-plugin-branch>
    
  6. Merge main into your branch:
    git merge main
    
Then fix any merge conflicts and make any needed changes to the plugin code to conform to the latest version of the SDK. When you’re ready to rebuild your plugin:
make <your-plugin>/build
Join our Developer SlackIf you’re still having trouble, join our Developer Slack workspace and we’ll help you figure out a solution.

Learn more