1Password Developer

1Password CLI brings 1Password to your terminal. Learn how to install the CLI, then integrate it with your 1Password app and sign in with Touch ID, Windows Hello, or another system authentication option.

Step 1: Install 1Password CLI

Requirements

  • Mac

  • Windows

  • Linux

  • Mac

  • Windows

  • Linux

  • homebrew

  • Manual

  1. To install 1Password CLI with homebrew:
  2. Check that 1Password CLI installed successfully:

To manually install 1Password CLI on macOS:

  1. Download the latest release of 1Password CLI.
    • Package file: Open op.pkg and install 1Password CLI in the default location (usr/local/bin).
    • ZIP file: Open op.zip and unzip the file, then move op to usr/local/bin.
  2. Check that 1Password CLI was installed successfully:
  • winget

  • Manual

  1. To install 1Password CLI with winget:
  2. Check that 1Password CLI installed successfully:

To manually install 1Password CLI on Windows:

  1. Download the latest release of 1Password CLI and extract op.exe.
  2. Open PowerShell as an administrator.
  3. Create a folder to move op.exe into. For example, C:\Program Files\1Password CLI.
  4. Move the op.exe file to the new folder.
  5. Add the folder containing the op.exe file to your PATH.

    Windows 10 and later

    1. Search for Advanced System Settings in the Start menu.
    2. Select Environment Variables.
    3. In the System Variables section, select the PATH environment variable and select Edit.
    4. In the prompt, select New and add the directory where op.exe is located.
    5. Sign out and back in to Windows for the change to take effect.
  6. Check that 1Password CLI installed successfully:

If you’d rather install 1Password CLI with a single block of commands, run the following in PowerShell as administrator:

  • APT

  • YUM

  • Alpine

  • NixOS

  • Manual

To install 1Password CLI using APT on Debian- and Ubuntu-based distributions:

  1. Run the following command:

    See a step-by-step version of the script

    1. Add the key for the 1Password apt repository:
    2. Add the 1Password apt repository:
    3. Add the debsig-verify policy:
    4. Install 1Password CLI:
  2. Check that 1Password CLI installed successfully:

Alternatively, download the latest 1Password CLI .deb package directly from one of the following links:

To install 1Password CLI using YUM on RPM-based distributions:

  1. Run the following commands:

    The above script is comprised of the following steps

    1. Import the public key:
    2. Configure the repository information:
    3. Install 1Password CLI:
  2. Check that 1Password CLI installed successfully:

Alternatively, download the latest 1Password CLI .rpm package directly from one of the following links:

To install 1Password CLI on Alpine x86_64 distributions:

  1. Run the following commands:

    The above script is comprised of the following steps

    1. Add Password CLI to your list of repositories:
    2. Add the public key to validate the APK to your keys directory:
    3. Install 1Password CLI:
  2. Check that 1Password CLI installed successfully:

To install 1Password CLI on your NixOS system:

  1. Add 1Password to your /etc/nixos/configuration.nix file, or flake.nix if you’re using a flake. For example, the following snippet includes 1Password CLI and the 1Password app:
  2. After you make changes to your configuration file, apply them:
    • If you added 1Password to /etc.nixos/configuration.nix, run:
    • If you added 1Password to flake.nix, replace <flake-directory-path> with the directory your flake is in and <output-name> with the name of the flake output containing your system configuration, then run the command.
  3. Check that 1Password CLI installed successfully:

Learn more about using 1Password on NixOS.

To install 1Password CLI on Linux without a package manager:

Or follow the extended guide

  1. Download the latest release of 1Password CLI and extract it. To verify its authenticity:
  2. Move op to /usr/local/bin, or another directory in your $PATH.
  3. Check that 1Password CLI installed successfully:
  4. Create the onepassword-cli group if it doesn’t yet exist:
  5. Set the correct permissions on the op binary:

Step 2: Turn on the 1Password desktop app integration

  • Mac

  • Windows

  • Linux

  1. Open and unlock the 1Password app.
  2. Select your account or collection at the top of the sidebar.
  3. Navigate to Settings > Developer.
  4. Select Integrate with 1Password CLI.
  5. If you want to authenticate 1Password CLI with your fingerprint, turn on Touch ID in the app.
  1. Open and unlock the 1Password app.
  2. Select your account or collection at the top of the sidebar.
  3. Turn on Windows Hello in the app.
  4. Navigate to Settings > Developer.
  5. Select Integrate with 1Password CLI.
  1. Open and unlock the 1Password app.
  2. Select your account or collection at the top of the sidebar.
  3. Navigate to Settings > Security.
  4. Turn on Unlock using system authentication.
  5. Navigate to Settings > Developer.
  6. Select Integrate with 1Password CLI.

Learn more about the 1Password desktop app integration.

Step 3: Enter any command to sign in

After you’ve turned on the app integration, enter any command and you’ll be prompted to authenticate. For example, run this command to see all the vaults in your account:

If you have multiple accounts

If you’ve added multiple 1Password accounts to your desktop app, you can use op signin to select an account to sign in to with 1Password CLI. Use the arrow keys to choose from the list of all accounts added to your 1Password app.

Learn more about using multiple accounts with 1Password CLI.

Next steps

  1. Get started with basic 1Password CLI commands.
  2. Set up 1Password Shell Plugins to handle authentication for your other command-line tools.
  3. Learn how to securely load secrets from your 1Password account without putting any plaintext secrets in code.

Learn more

Read the original on 1password.dev ↗