> ## Documentation Index
> Fetch the complete documentation index at: https://www.1password.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started with 1Password CLI

export const Image = ({src, darkSrc, alt, width, border, height, round}) => {
  const classNames = ["mint-mx-4"];
  if (border) {
    classNames.push("mint-rounded-sm");
  }
  if (round) {
    classNames.push("mint-rounded-lg");
  }
  const style = {};
  if (width) style.width = typeof width === "number" ? `${width}px` : width;
  if (height) style.height = typeof height === "number" ? `${height}px` : height;
  return darkSrc ? <>
      <img src={src} alt={alt} className={[...classNames, "dark:hidden"].join(" ")} style={Object.keys(style).length > 0 ? style : undefined} />
      <img src={darkSrc} alt={alt} className={[...classNames, "hidden dark:block"].join(" ")} style={Object.keys(style).length > 0 ? style : undefined} onError={e => {
    e.target.src = src;
  }} />
    </> : <img src={src} alt={alt} className={classNames.join(" ")} style={Object.keys(style).length > 0 ? style : undefined} />;
};

export const CodeResult = ({children, resultLang, wrap, expandable}) => {
  const parseChildren = () => {
    let language = "text";
    let codeContent = "";
    const extractText = node => {
      if (typeof node === "string") {
        return node;
      }
      if (Array.isArray(node)) {
        return node.map(extractText).join("");
      }
      if (node?.props?.children) {
        return extractText(node.props.children);
      }
      return "";
    };
    const extractLanguage = node => {
      if (!node) return null;
      if (node.props?.className) {
        const className = node.props.className;
        const langMatch = className.match(/language-(\w+)/);
        if (langMatch) {
          return langMatch[1];
        }
      }
      if (node.props?.["data-language"]) {
        return node.props["data-language"];
      }
      if (node.props?.language) {
        return node.props.language;
      }
      return null;
    };
    if (typeof children === "string") {
      codeContent = children;
    } else if (Array.isArray(children)) {
      codeContent = extractText(children);
      for (const child of children) {
        const detectedLang = extractLanguage(child);
        if (detectedLang) {
          language = detectedLang;
          break;
        }
      }
    } else if (children?.props) {
      const detectedLang = extractLanguage(children);
      if (detectedLang) {
        language = detectedLang;
      }
      codeContent = extractText(children);
    }
    const parts = codeContent.split("#code-result");
    if (parts.length < 2) {
      return {
        command: codeContent.trim(),
        result: null,
        language,
        defaultOpen: false
      };
    }
    const resultText = parts[1].trim();
    const defaultOpen = resultText.startsWith("open");
    const cleanResult = defaultOpen ? resultText.slice(4).trim() : resultText;
    return {
      command: parts[0].trim(),
      result: cleanResult,
      language,
      defaultOpen
    };
  };
  const {command, result, language, defaultOpen} = parseChildren();
  const [isOpen, setIsOpen] = useState(defaultOpen);
  if (!result) {
    return children;
  }
  return <div className="codeblock_accordion not-prose mb-4">
      {}
      <div className="[&>*]:!mb-0 [&>*]:!rounded-b-none">
        <CodeBlock language={language} children={command} wrap={wrap} expandable={expandable} />
      </div>

      {}
      <div className="see_results_container border-t-0 bg-gray-100/80 dark:bg-gray-800/80 overflow-hidden" style={{
    marginTop: "-0.25rem"
  }}>
        <button onClick={() => setIsOpen(!isOpen)} className="w-full px-4 py-2.5 flex items-center gap-1 text-left text-[14px] font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-200/60 dark:hover:bg-gray-700/60 transition-all duration-150" aria-expanded={isOpen}>
          {isOpen ? <Icon icon="caret-down" size="14" iconType="solid" /> : <Icon icon="caret-right" size="14" iconType="solid" />}

          <span>See result...</span>
        </button>

        {isOpen && <div className="[&>*]:!mt-0 [&>*]:!rounded-t-none border-t border-gray-200/50 dark:border-gray-700/50">
            <CodeBlock language={resultLang || language} children={result} wrap={wrap} expandable={expandable} />
          </div>}
      </div>
    </div>;
};

export const Small = ({children}) => {
  return <small>{children}</small>;
};

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

<Accordion title="Requirements">
  <Tabs groupId="operating-systems">
    <Tab title="Mac">
      * [1Password subscription](https://1password.com/pricing/password-manager)
      * [1Password for Mac](https://1password.com/downloads/mac)\*
      * macOS Big Sur 11.0.0 or later

      Supported shells: Bash, Zsh, sh, fish

      <Small>\*Required to integrate 1Password CLI with the 1Password app.</Small>
    </Tab>

    <Tab title="Windows">
      * [1Password subscription](https://1password.com/pricing/password-manager)
      * [1Password for Windows](https://1password.com/downloads/windows)

      Supported shells: PowerShell
    </Tab>

    <Tab title="Linux">
      * [1Password subscription](https://1password.com/pricing/password-manager)
      * [1Password for Linux](https://1password.com/downloads/linux)\*
      * [PolKit](https://github.com/polkit-org/polkit)\*
      * A PolKit authentication agent running\*

      Supported shells: Bash, Zsh, sh, fish

      <Small>\*Required to integrate 1Password CLI with the 1Password app.</Small>
    </Tab>
  </Tabs>
</Accordion>

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    <Tabs groupId="mac-distro">
      <Tab title="homebrew">
        1. To install 1Password CLI with [homebrew](https://brew.sh/):

           ```shell theme={null}
           brew install 1password-cli
           ```

        2. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```

        <Small>The <a href="https://formulae.brew.sh/cask/1password-cli">1Password Homebrew cask <Icon icon="arrow-up-right-from-square" /></a> is maintained by both Homebrew and 1Password developers in the open-source [Homebrew Cask repository. <Icon icon="github" />](https://github.com/Homebrew/homebrew-cask) 1Password CLI downloads from our CDN on agilebits.net/.com domains. </Small>
      </Tab>

      <Tab title="Manual">
        To manually install 1Password CLI on macOS:

        1. Download [the latest release of 1Password CLI](https://app-updates.agilebits.com/product_history/CLI2).<br /> <Small>Learn how to [verify its authenticity](/cli/verify/).</Small>
        2. * **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`.
        3. Check that 1Password CLI was installed successfully:

           ```shell theme={null}
           op --version
           ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="Windows">
    <Tabs groupId="windows-distro">
      <Tab title="winget">
        1. To install 1Password CLI with winget:

           ```powershell theme={null}
           winget install 1password-cli
           ```

        2. Check that 1Password CLI installed successfully:

           ```powershell theme={null}
           op --version
           ```
      </Tab>

      <Tab title="Manual">
        To manually install 1Password CLI on Windows:

        1. Download [the latest release of 1Password CLI](https://app-updates.agilebits.com/product_history/CLI2) and extract `op.exe`.<br /> <Small>Learn how to [verify its authenticity](/cli/verify/).</Small>

        2. Open PowerShell **as an administrator**.

        3. Create a folder to move `op.exe` into. For example, `C:\Program Files\1Password CLI`.

           ```powershell theme={null}
           mkdir "C:\Program Files\1Password CLI"
           ```

        4. Move the `op.exe` file to the new folder.

           ```powershell theme={null}
           mv ".\op.exe" "C:\Program Files\1Password CLI"
           ```

        5.         <Accordion title="Add the folder containing the op.exe file to your PATH.">
                     **Windows 10 and later**

                     <ol style={{ listStyleType: "decimal" }}>
                       <li>Search for <strong>Advanced System Settings</strong> in the Start menu.</li>
                       <li>Select <strong>Environment Variables</strong>.</li>
                       <li>In the System Variables section, select the <strong>PATH</strong> environment variable and select <strong>Edit</strong>.</li>
                       <li>In the prompt, select <strong>New</strong> and add the directory where <code>op.exe</code>{" "} is located.</li>
                       <li>Sign out and back in to Windows for the change to take effect.</li>
                     </ol>
                   </Accordion>

        6. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```

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

        ```powershell theme={null}
        $arch = (Get-CimInstance Win32_OperatingSystem).OSArchitecture
        switch ($arch) {
            '64-bit' { $opArch = 'amd64'; break }
            '32-bit' { $opArch = '386'; break }
            Default { Write-Error "Sorry, your operating system architecture '$arch' is unsupported" -ErrorAction Stop }
        }
        $installDir = Join-Path -Path $env:ProgramFiles -ChildPath '1Password CLI'
        Invoke-WebRequest -Uri "https://cache.agilebits.com/dist/1P/op2/pkg/v2.33.1/op_windows_$($opArch)_v2.33.1.zip" -OutFile op.zip
        Expand-Archive -Path op.zip -DestinationPath $installDir -Force
        $envMachinePath = [System.Environment]::GetEnvironmentVariable('PATH','machine')
        if ($envMachinePath -split ';' -notcontains $installDir){
            [Environment]::SetEnvironmentVariable('PATH', "$envMachinePath;$installDir", 'Machine')
        }
        Remove-Item -Path op.zip
        ```

        <Small>
          If your Windows operating system uses a language other than English, you'll need to manually set <code>\$arch</code> in the first line. To do this, replace <code>\$arch = (Get-CimInstance Win32\_OperatingSystem).OSArchitecture</code> with <code>\$arch = "64-bit"</code> or <code>\$arch = "32-bit"</code>.
        </Small>
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="Linux">
    <Tabs groupId="linux-distro">
      <Tab title="APT">
        To install 1Password CLI using APT on Debian- and Ubuntu-based distributions:

        1. Run the following command:

           ```shell theme={null}
           curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
             sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg && \
             echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/$(dpkg --print-architecture) stable main" | \
             sudo tee /etc/apt/sources.list.d/1password.list && \
             sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/ && \
             curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | \
             sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol && \
             sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22 && \
             curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
             sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg && \
             sudo apt update && sudo apt install 1password-cli
           ```

                   <Accordion title="See a step-by-step version of the script">
                     1. Add the key for the 1Password `apt` repository:

                        ```shell theme={null}
                        curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
                          sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
                        ```

                     2. Add the 1Password `apt` repository:

                        ```shell theme={null}
                        echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/$(dpkg --print-architecture) stable main" |
                          sudo tee /etc/apt/sources.list.d/1password.list
                        ```

                     3. Add the debsig-verify policy:

                        ```shell theme={null}
                        sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/
                          curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | \
                          sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol && \
                          sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22 && \
                          curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
                          sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg
                        ```

                     4. Install 1Password CLI:

                        ```shell theme={null}
                        sudo apt update && sudo apt install 1password-cli
                        ```
                   </Accordion>

        2. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```

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

        * [amd64](https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb)
        * [386](https://downloads.1password.com/linux/debian/386/stable/1password-cli-386-latest.deb)
        * [arm](https://downloads.1password.com/linux/debian/arm/stable/1password-cli-arm-latest.deb)
        * [arm64](https://downloads.1password.com/linux/debian/arm64/stable/1password-cli-arm64-latest.deb)
      </Tab>

      <Tab title="YUM">
        To install 1Password CLI using YUM on RPM-based distributions:

        1. Run the following commands:

           ```shell theme={null}
           sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc
           sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\"https://downloads.1password.com/linux/keys/1password.asc\"" > /etc/yum.repos.d/1password.repo'
           sudo dnf check-update -y 1password-cli && sudo dnf install 1password-cli
           ```

                   <Accordion title="The above script is comprised of the following steps">
                     1. Import the public key:

                        ```shell theme={null}
                        sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc
                        ```

                     2. Configure the repository information:

                        ```shell theme={null}
                        sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\"https://downloads.1password.com/linux/keys/1password.asc\"" > /etc/yum.repos.d/1password.repo'
                        ```

                     3. Install 1Password CLI:

                        ```shell theme={null}
                        sudo dnf check-update -y 1password-cli && sudo dnf install 1password-cli
                        ```
                   </Accordion>

        2. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```

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

        * [x86\_64](https://downloads.1password.com/linux/rpm/stable/x86_64/1password-cli-latest.x86_64.rpm)
        * [i386](https://downloads.1password.com/linux/rpm/stable/i386/1password-cli-latest.i386.rpm)
        * [aarch64](https://downloads.1password.com/linux/rpm/stable/aarch64/1password-cli-latest.aarch64.rpm)
        * [armv7l](https://downloads.1password.com/linux/rpm/stable/armv7l/1password-cli-latest.armv7l.rpm)
      </Tab>

      <Tab title="Alpine">
        To install 1Password CLI on Alpine x86\_64 distributions:

        1. Run the following commands:

           ```shell theme={null}
           echo https://downloads.1password.com/linux/alpinelinux/stable/ >> /etc/apk/repositories
           wget https://downloads.1password.com/linux/keys/alpinelinux/support@1password.com-61ddfc31.rsa.pub -P /etc/apk/keys
           apk update && apk add 1password-cli
           ```

                   <Accordion title="The above script is comprised of the following steps">
                     1. Add Password CLI to your list of repositories:

                        ```shell theme={null}
                        echo https://downloads.1password.com/linux/alpinelinux/stable/ >> /etc/apk/repositories
                        ```

                     2. Add the public key to validate the APK to your keys directory:

                        ```shell theme={null}
                        wget https://downloads.1password.com/linux/keys/alpinelinux/support@1password.com-61ddfc31.rsa.pub -P /etc/apk/keys
                        ```

                     3. Install 1Password CLI:

                        ```shell theme={null}
                        apk update && apk add 1password-cli
                        ```
                   </Accordion>

        2. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```
      </Tab>

      <Tab title="NixOS">
        <Warning>
          The Nix package is available from the NixOS open source community.
        </Warning>

        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:

           ```nix theme={null}
           # NixOS has built-in modules to enable 1Password
           # along with some pre-packaged configuration to make
           # it work nicely. You can search what options exist
           # in NixOS at https://search.nixos.org/options

           # Enables the 1Password CLI
           programs._1password = { enable = true; };

           # Enables the 1Password desktop app
           programs._1password-gui = {
           enable = true;
           # this makes system auth etc. work properly
           polkitPolicyOwners = [ "<your-linux-username>" ];
           };
           ```

        2. After you make changes to your configuration file, apply them:

           * If you added 1Password to `/etc.nixos/configuration.nix`, run:

             ```shell theme={null}
             sudo nixos-rebuild switch
             ```

           * 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.

             ```shell theme={null}
             sudo nixos-rebuild switch --flake <flake-directory-path>.#<output-name>
             ```

        3. Check that 1Password CLI installed successfully:

           ```shell theme={null}
           op --version
           ```

        Learn more about [using 1Password on NixOS. <Icon icon="arrow-up-right-from-square" />](https://nixos.wiki/wiki/1Password)
      </Tab>

      <Tab title="Manual">
        To install 1Password CLI on Linux without a package manager:

        ```shell theme={null}
        ARCH="<choose between 386/amd64/arm/arm64>" && \
        wget "https://cache.agilebits.com/dist/1P/op2/pkg/v2.33.1/op_linux_${ARCH}_v2.33.1.zip" -O op.zip && \
        unzip -d op op.zip && \
        sudo mv op/op /usr/local/bin/ && \
        rm -r op.zip op && \
        sudo groupadd -f onepassword-cli && \
        sudo chgrp onepassword-cli /usr/local/bin/op && \
        sudo chmod g+s /usr/local/bin/op
        ```

        <Accordion title="Or follow the extended guide">
          1. Download the [latest release of 1Password CLI](https://app-updates.agilebits.com/product_history/CLI2) and extract it. To verify its authenticity:

             ```shell theme={null}
             gpg --keyserver keyserver.ubuntu.com --receive-keys 3FEF9748469ADBE15DA7CA80AC2D62742012EA22
             gpg --verify op.sig op
             ```

          2. Move `op` to `/usr/local/bin`, or another directory in your `$PATH`.

          3. Check that 1Password CLI installed successfully:

             ```shell theme={null}
             op --version
             ```

          4. Create the `onepassword-cli` group if it doesn't yet exist:

             ```shell theme={null}
             sudo groupadd onepassword-cli
             ```

          5. Set the correct permissions on the `op` binary:

             ```shell theme={null}
             sudo chgrp onepassword-cli /usr/local/bin/op && \
             sudo chmod g+s /usr/local/bin/op
             ```
        </Accordion>
      </Tab>
    </Tabs>
  </Tab>
</Tabs>

## Step 2: Turn on the 1Password desktop app integration

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    <CardGroup cols={2}>
      <div>
        1. Open and unlock the [1Password app](https://1password.com/downloads/).
        2. Select your account or collection at the top of the sidebar.
        3. Navigate to **Settings** > **[Developer](onepassword://settings/developers)**.
        4. Select **Integrate with 1Password CLI**.
        5. If you want to authenticate 1Password CLI with your fingerprint, turn on **[Touch ID](https://support.1password.com/touch-id-mac/)** in the app.
      </div>

      <div>
        <Frame>
          <Image border round alt="The 1Password Developer settings pane with the Integrate with 1Password CLI option selected." src="/static/img/cli/developer-settings-light.png" darksrc="/static/img/cli/developer-settings-dark.png" />
        </Frame>
      </div>
    </CardGroup>
  </Tab>

  <Tab title="Windows">
    <CardGroup cols={2}>
      <div>
        1. Open and unlock the [1Password app](https://1password.com/downloads/).
        2. Select your account or collection at the top of the sidebar.
        3. Turn on **[Windows Hello](https://support.1password.com/windows-hello/)** in the app.
        4. Navigate to **Settings** > **[Developer](onepassword://settings/developers)**.
        5. Select **Integrate with 1Password CLI**.
      </div>

      <div>
        <Frame>
          <Image border alt="The 1Password Developer settings pane with the Integrate with 1Password CLI option selected." src="/static/img/cli/developer-settings-windows-light.png" darksrc="/static/img/cli/developer-settings-windows-dark.png" />
        </Frame>
      </div>
    </CardGroup>
  </Tab>

  <Tab title="Linux">
    <CardGroup cols={2}>
      <div>
        1. Open and unlock the [1Password app](https://1password.com/downloads/).
        2. Select your account or collection at the top of the sidebar.
        3. Navigate to **Settings** > **[Security](onepassword://settings/security)**.
        4. Turn on **[Unlock using system authentication](https://support.1password.com/system-authentication-linux/)**.
        5. Navigate to **Settings** > **[Developer](onepassword://settings/developers)**.
        6. Select **Integrate with 1Password CLI**.
      </div>

      <div>
        <Frame>
          <Image border round alt="The 1Password Developer settings pane with the Integrate with 1Password CLI option selected." src="/static/img/cli/developer-settings-linux.png" darksrc="/static/img/cli/developer-settings-linux-dark.png" />
        </Frame>
      </div>
    </CardGroup>
  </Tab>
</Tabs>

[Learn more about the 1Password desktop app integration.](/cli/app-integration/)

## Step 3: Enter any command to sign in

<Frame>
  <video loop autoPlay muted playsInline>
    <source type="video/mp4" src="https://mintcdn.com/ab-634991b8/MKy6sgNGqMk-yGDS/static/videos/auth-prompt.mp4?fit=max&auto=format&n=MKy6sgNGqMk-yGDS&q=85&s=8c2d961717ae9db95db4505dc0ea0832" width="600px" data-path="static/videos/auth-prompt.mp4" />
  </video>
</Frame>

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:

```shell theme={null}
op vault list
```

#### If you have multiple accounts

If you've added multiple 1Password accounts to your desktop app, you can use [`op signin`](/cli/reference/commands/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.

<CodeResult>
  ```shell highlight={2} theme={null}
  op signin
  #code-result
  Select account  [Use arrows to move, type to filter]
  > ACME Corp (acme.1password.com)
    AgileBits (agilebits.1password.com)
    Add another account
  ```
</CodeResult>

[Learn more about using multiple accounts with 1Password CLI.](/cli/use-multiple-accounts/)

## Next steps

1. [Get started with basic 1Password CLI commands.](/cli/reference/)
2. [Set up 1Password Shell Plugins to handle authentication for your other command-line tools.](/cli/shell-plugins/)
3. [Learn how to securely load secrets from your 1Password account without putting any plaintext secrets in code.](/cli/secret-references/)

## Learn more

* [1Password app integration troubleshooting](/cli/app-integration/#troubleshooting)
* [1Password app integration security](/cli/app-integration-security/)
* [How 1Password CLI detects configuration directories](/cli/config-directories)
