Best for · Password managers
1Password command line (op): install, sign in and use it
- Last checked
- 4 sources, linked below
- By the vectaai team
We read every plan page. Paid links are labelled. Money never changes a ranking. How we pick.
Verdict Our pick
The bar guide has a call.

- The 1Password command line tool is called op.
Compared here
- 01op read
- 02op run
- 03op inject
Short answer
The 1Password command line tool is called op. Install it (brew install 1password-cli on Mac, winget install 1password-cli on Windows, or a package repository on Linux), turn on Integrate with 1Password CLI in the desktop app under Settings, Developer, then run any command and approve the prompt. Start with op vault list to confirm it works. It needs a 1Password subscription.
The part worth learning is secret references: a text pointer like op://development/GitHub/credentials/personal_token. You put the pointer in your scripts and config files instead of the real secret. Then op read prints one secret, op run passes secrets to a command as environment variables, and op inject fills in a config template. Everything below comes from 1Password's own documentation, read on 4 December 2026.
Sponsored links. We may earn a commission; it never changes the pick.
At a glance
| Command | What it does | Example from the docs | Use it when |
|---|---|---|---|
| op read | Prints one secret to the terminal, or to a file with --out-file | op read op://development/GitHub/credentials/personal_token | A script needs one value, such as a token |
| op run | Loads secrets into environment variables for one command only | op run -- node app.js | An app reads secrets from environment variables |
| op inject | Replaces references in a text file with real values | op inject --in-file config.yml.tpl --out-file config.yml | A config file needs several secrets |
| op vault list | Shows the vaults in your account | op vault list | First check that sign-in works |
| op signin | Chooses an account when you have more than one | op signin | You use several 1Password accounts |
What the 1Password command line is for
You already use 1Password to fill in passwords in a browser. The command line tool, op, does a different job: it lets scripts and programs get secrets from your vault without you pasting them anywhere.
Think of the classic mess. A database password in a .env file. An API token in a shell history. A config file with a password you swore you would delete. The CLI replaces those with a pointer. The file says where the secret lives, and 1Password hands over the real value only when you run the command, after you approve it with your fingerprint or system password.
It is a tool for people who work in a terminal. If you do not, skip this page and keep using the app.
What you need first
Per the Get started page, read on 4 December 2026:
- All platforms: a 1Password subscription.
- Mac: 1Password for Mac (needed for app integration), macOS Big Sur 11.0.0 or later. Supported shells: Bash, Zsh, sh, fish.
- Windows: 1Password for Windows. Supported shell: PowerShell.
- Linux: 1Password for Linux, PolKit and a running PolKit authentication agent, all required for app integration. Supported shells: Bash, Zsh, sh, fish.
- WSL: the docs say app integration does not work with a CLI installed inside Linux on WSL. Install the Windows version and call
op.exefrom WSL.
On cost: 1Password's pricing page showed Individual at $3.99 a month billed yearly, listed at $2.99 a month during a promo for new customers buying directly from 1Password.com, with a 14 day trial and no credit card required. The page offers USD, CAD and EUR, and we read the USD figures. For more on plans, see our 1Password pricing review.
Install
Mac
- Homebrew:
brew install 1password-cli - Or download the package or ZIP and put
opinusr/local/bin.
Windows
- winget:
winget install 1password-cli - Or extract
op.exeto a folder such asC:\Program Files\1Password CLIand add it to your PATH. The docs offer a PowerShell script for that and say ARM devices should use winget.
Linux
- APT for Debian and Ubuntu, YUM or DNF for RPM-based systems, and
apkfor Alpine, each with a repository setup. - NixOS: add the
programs._1passwordmodule. The page notes the Nix package comes from the community. - Or a manual script that installs
opand sets theonepassword-cligroup permissions.
Every method ends with op --version. If you see a version number, you are done.
Sign in without typing a password
The easiest route is the desktop app integration. The docs list these steps:
- Open and unlock the 1Password app and select your account.
- Turn on the integration. Mac: Settings, Developer, "Integrate with 1Password CLI," and optionally Touch ID. Windows: turn on Windows Hello in the app, then Settings, Developer. Linux: turn on "Unlock using system authentication" under Settings, Security, then enable the integration under Settings, Developer.
- Run any command. The page says "After you've turned on the app integration, enter any command and you'll be prompted to authenticate."
Try op vault list. It shows the vaults in your account, and it is the check the docs suggest first.
If no prompt appears, the docs say to check three things: an administrator may have restricted the integration, the toggle may be off, and the app must be unlocked and signed into the same user account you are using in the terminal. For automation on headless servers, the docs point to service account tokens as the alternative. We did not read the service account pages, so we cannot give you their limits or setup.
Using more than one account
The multiple accounts page says commands run against the account you signed in to most recently. You can:
- run
op signinand choose an account; - add
--accountwith the sign-in address or ID, for exampleop vault ls --account my.1password.com; - set the
OP_ACCOUNTenvironment variable, which also works in scripts; - find addresses and IDs with
op account list.
Secret references: the idea that makes it useful
A secret reference is a text address for a value in your vault. From the secret references page:
op://<vault-name>/<item-name>/[section-name/]<field-name>
The section is optional. You can also use unique IDs for the vault, item, section and field. Add ?attribute= to ask for something specific. The page's examples:
op read "op://development/GitHub/Security/one-time password?attribute=otp"
op read "op://Private/ssh keys/ssh key/private key?ssh-format=openssh"
Field attributes include type, value, title, id, purpose and otp. File attachments support content, size, id, name and type.
The reference itself holds no secret. That is the point: you can put it in a config file, commit it to Git, and share the file, because the real value only appears when someone with vault access runs a command.
op read: get one secret
op read prints a secret to the terminal:
op read op://development/GitHub/credentials/personal_token
Write it to a file with --out-file (or -o):
op read --out-file token.txt op://development/GitHub/credentials/personal_token
Use it inside a script. This one is straight from the docs:
docker login -u "$(op read op://prod/docker/username)" -p "$(op read op://prod/docker/password)"
op run: give an app its secrets and nothing else
op run finds environment variables that hold secret references, loads the real values, and runs a command with them set as environment variables for that process only. Set the variables to references:
export DB_USER="op://app-dev/db/user"
export DB_PASSWORD="op://app-dev/db/password"
op run -- node app.js
Or keep the references in an environment file and point to it:
op run --env-file="./node.env" -- node app.js
Secrets printed to standard output are masked by default; the docs show op run -- printenv DB_PASSWORD returning <concealed by 1Password>. Add --no-masking to see them. One gotcha from the docs: if you reference a variable in the same command as op run, your shell may expand it first. Pass the variable to a subshell, for example MY_VAR=op://vault/item/field op run --no-masking -- sh -c 'echo "$MY_VAR"'.
op inject: fill in a template
op inject replaces references in text. It reads standard input and writes standard output by default, and takes --in-file (-i) and --out-file (-o) for files. The docs show a config template that can be committed to Git because it contains only references:
database:
host: http://localhost
port: 5432
username: op://prod/mysql/username
password: op://prod/mysql/password
op inject --in-file config.yml.tpl --out-file config.yml
Now the real config.yml exists only on the machine that ran the command. Add it to your .gitignore and the template stays the only thing in the repo.
Which one to use
| Situation | Use |
|---|---|
| One token for a single command | op read |
| An app that reads environment variables | op run |
| A config file with several secrets | op inject |
| A cloud tool such as the AWS CLI | The shell plugin approach; see 1Password AWS CLI |
What we did not test
We read the documentation. We did not install the CLI on each platform or time a single command, so we make no claims about speed or about any bug you may meet. The docs also point to Shell Plugins and a basic command reference, which we did not read in full today. Pricing figures are in US dollars as shown and can change.
Money talk: we have a link to 1Password at vectaai.com/go/1password. We could not verify a consumer affiliate program for 1Password, and the link does not change the facts on this page. If you want a no-cost option to compare, see 1Password vs Bitwarden, and our note on the 1Password free trial. How we work is on the how we pick page.
Questions people ask
How do I install 1Password CLI?
On Mac, run brew install 1password-cli. On Windows, run winget install 1password-cli. On Linux, 1Password documents APT, YUM or DNF and Alpine apk repositories. Each method ends with op --version to confirm the install. You also need a 1Password subscription, and app integration needs the 1Password desktop app.
Does 1Password CLI require a paid account?
The docs list a 1Password subscription as a requirement on all platforms. 1Password's pricing page showed Individual at $3.99 a month billed yearly, with a promo price of $2.99 for new customers, and a 14 day trial. We did not find any free CLI-only tier on the pages we read.
How do I sign in to the 1Password CLI?
Open and unlock the desktop app, go to Settings, Developer, and select Integrate with 1Password CLI. On Windows turn on Windows Hello first; on Linux turn on unlock using system authentication. Then run any op command and you are prompted to authenticate. With several accounts, run op signin and pick one.
What is op run?
op run finds environment variables that hold secret references, loads the real values, and runs your command with them set for that process only. Example: op run -- node app.js. Secrets printed to stdout are masked by default, and you can turn masking off with --no-masking when you need to debug.
What is a secret reference in 1Password?
A text pointer to a value in your vault, written as op://vault/item/section/field. The section is optional. You can swap names for unique IDs, and add query parameters such as ?attribute=otp to read a one-time password. The reference is safe to commit to Git because it contains no secret.
Does 1Password CLI work with WSL?
Not the Linux install. The docs say app integration does not work with a CLI installed inside Linux on WSL. Install the Windows version and call op.exe from WSL instead. That keeps the desktop app handling the sign-in prompt.
Sources
Every fact above comes from these pages. Prices change, so each one carries the date we read it.
- 1Password CLI: Get started, checked 4 Dec 2026
- 1Password CLI: Secret references, checked 4 Dec 2026
- 1Password CLI: Use multiple accounts, checked 4 Dec 2026
- 1Password pricing, checked 4 Dec 2026