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

# Use the 1Password desktop app to sign in to 1Password CLI

export const BetaBadge = ({content}) => {
  if (content) {
    return <span className="op-beta-badge-inline not-prose">
        <span className="op-status-badge">Beta</span>
      </span>;
  }
  return <>
      <style>
        {`
        .mdx-content {
          margin-top: 4px !important;
        }
      `}
      </style>
      <span className="op-status-badge not-prose">Beta</span>
    </>;
};

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-[var(--op-border-ui)] dark:border-[var(--op-border-ui-dark)]">
            <CodeBlock language={resultLang || language} children={result} wrap={wrap} expandable={expandable} />
          </div>}
      </div>
    </div>;
};

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 BetaWrap = ({children}) => {
  return <></>;
};

You can use the [1Password desktop app](https://1password.com/downloads) integration to quickly and securely sign in to [1Password CLI](/cli/get-started/). The app integration allows you to:

* Seamlessly sign to the 1Password accounts you've added to the app in your terminal.
* Authenticate 1Password CLI the same way you unlock your device, like with your fingerprint, face, Apple Watch, Windows Hello PIN, or device user password.
* Track recent 1Password CLI activity from your 1Password app.

## Requirements

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    * [1Password subscription](https://1password.com/pricing/password-manager)
    * [1Password for Mac](https://1password.com/downloads/mac)
  </Tab>

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

  <Tab title="Linux">
    * [1Password subscription](https://1password.com/pricing/password-manager)
    * [1Password for Linux](https://1password.com/downloads/linux)
    * [PolKit](https://gitlab.freedesktop.org/polkit/polkit) (included in many popular distributions)
    * A PolKit authentication agent running
  </Tab>
</Tabs>

## Set up the app integration

### Step 1: Turn on the 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>

### Step 2: 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>

You can also [select an account on a per-command basis using the `--account` flag](/cli/use-multiple-accounts/#specify-an-account-per-command-with-the-account-flag) with your account's sign-in address or ID.

```shell theme={null}
op vault ls --account my.1password.com
```

If you're signed in to multiple accounts in the app but only want to use a specific account with 1Password CLI, you can [set the `OP_ACCOUNT` environment variable](/cli/use-multiple-accounts/#set-an-account-with-the-op_account-environment-variable) to your account's sign-in address or ID.

### Optional: Remove previously added account details

<Warning>
  Make sure you have access to your Secret Key and account password before removing account details from your configuration file.
</Warning>

If you previously [added an account to 1Password CLI manually](/cli/sign-in-manually/) and now want to exclusively use the 1Password app to sign in, you can remove your account details from your configuration file.

Your configuration file is in one of the following locations:

* `~/.op/config`
* `~/.config/op/config`
* `~/.config/.op/config`

Use the [account forget](/cli/reference/management-commands/account/#account-forget) command to remove all existing account information from your configuration file. This won't impact the accounts added to your 1Password app.

```shell theme={null}
op account forget --all
```

### Optional: Set the biometric unlock environment variable

You can use the `OP_BIOMETRIC_UNLOCK_ENABLED` environment variable to temporarily toggle the app integration on or off.

To turn on the integration:

<CodeGroup>
  <CodeBlock filename="Bash, Zsh, sh" language="shell" children={`export OP_BIOMETRIC_UNLOCK_ENABLED=true`} />

  <CodeBlock filename="fish" language="shell" children={`set -x OP_BIOMETRIC_UNLOCK_ENABLED true`} />

  <CodeBlock filename="PowerShell" language="powershell" children={`$Env:OP_BIOMETRIC_UNLOCK_ENABLED = "true"`} />
</CodeGroup>

To turn off the integration:

<CodeGroup>
  <CodeBlock filename="Bash, Zsh, sh" language="shell" children={`export OP_BIOMETRIC_UNLOCK_ENABLED=false`} />

  <CodeBlock filename="fish" language="shell" children={`set -x OP_BIOMETRIC_UNLOCK_ENABLED false`} />

  <CodeBlock filename="PowerShell" language="powershell" children={`$Env:OP_BIOMETRIC_UNLOCK_ENABLED = "false"`} />
</CodeGroup>

<BetaWrap>
  **Set a default account to use with the 1Password app integration** <BetaBadge content />

  Run `op account use` to set a default 1Password account to use with the 1Password app integration in your current terminal session. 1Password CLI will prompt you to select an account.

  ```shell theme={null}
  op account use --account my.1password.com
  ```
</BetaWrap>

## Track 1Password CLI activity

You can track 1Password CLI activity authenticated with the 1Password app, including the command, when it was run, the application where it was run, and the name of the account accessed.

<CardGroup cols={2}>
  <div>
    To see your 1Password CLI activity log:

    1. Open and unlock the 1Password desktop app.
    2. Select **Developer** in the sidebar.
    3. Select **View CLI**.
  </div>

  <div>
    <Frame>
      <img alt="The 1Password CLI activity log." src="https://mintcdn.com/ab-634991b8/pfc4yDcmGyZA8XDs/static/img/cli/activity-log-light.png?fit=max&auto=format&n=pfc4yDcmGyZA8XDs&q=85&s=a26e769819da6c13bbb76a359d8c83e5" width="1524" height="914" data-path="static/img/cli/activity-log-light.png" />
    </Frame>
  </div>
</CardGroup>

You'll see a table with your recent 1Password CLI activity.

Your activity log data is encrypted on your device. Older entries get purged regularly, and you can manually clear your activity log data at any time. If you don’t want to use activity logging, turn off **Record and display activity** in the [1Password Developer settings](onepassword://settings/developers).

## Troubleshooting

### If `op signin` doesn't list your account

`op signin` returns a list of all accounts you've added to the 1Password desktop app. To sign in to 1Password CLI with a new 1Password account, you'll need to [add the account to the app](https://support.1password.com/add-account/).

### If you see a connection error

If you see a `connectionreset` error, or an error that 1Password CLI couldn't connect to the 1Password desktop app, try the following:

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    Open **System Settings** > **General** > **Login Items** and make sure **Allow in background** is turned on for 1Password.

    <br />

    If you still see an error, try the following:

    1. Make sure you're using the latest version of the 1Password desktop app.
    2. Restart the app.

    If you're using 1Password for Mac version 8.10.12 or earlier, the 1Password CLI binary must be located in the `/usr/local/bin/` directory.
  </Tab>

  <Tab title="Windows">
    1. Make sure you're using the latest version of the 1Password desktop app.
    2. Restart the app.
  </Tab>

  <Tab title="Linux">
    1. Make sure you're using the latest version of the 1Password desktop app.
    2. Restart the app.
  </Tab>
</Tabs>

If you see a `LostConnectionToApp` error when you try to authenticate:

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    Make sure the option to keep 1Password in the menu bar is turned on:

    1. Open and unlock the 1Password desktop app.
    2. Select your account or collection at the top of the sidebar.
    3. Select **Settings** > **General**.
    4. Make sure "Keep 1Password in the menu bar" is selected.
  </Tab>

  <Tab title="Windows">
    Make sure the option to keep 1Password in the notification area is turned on:

    1. Open and unlock the 1Password desktop app.
    2. Select your account or collection at the top of the sidebar.
    3. Select **Settings** > **General**.
    4. Make sure "Keep 1Password in the notification area" is selected.
  </Tab>

  <Tab title="Linux">
    Make sure the option to keep 1Password in the system tray is turned on:

    1. Open and unlock the 1Password desktop app.
    2. Select your account or collection at the top of the sidebar.
    3. Select **Settings** > **General**.
    4. Make sure "Keep 1Password in the system tray" is selected.
  </Tab>
</Tabs>

### If you aren't prompted to authenticate with your preferred method

If you've turned on the app integration, but aren't prompted to sign in to 1Password CLI with your expected authentication method:

<Tabs groupId="operating-systems">
  <Tab title="Mac">
    Make sure you've set up [Touch ID](https://support.1password.com/touch-id-mac/) or an [Apple Watch](https://support.1password.com/apple-watch-mac/) to unlock 1Password on your Mac.
  </Tab>

  <Tab title="Windows">
    Make sure you've set up [Windows Hello](https://support.1password.com/windows-hello/) to unlock 1Password on your Windows PC.
  </Tab>

  <Tab title="Linux">
    1. Make sure you've set up [system authentication](https://support.1password.com/system-authentication-linux/) to unlock 1Password on your Linux computer.
    2. Update the authentication method in your Linux settings to use a [fingerprint](https://help.ubuntu.com/stable/ubuntu-help/session-fingerprint.html.en) or other biometrics instead of your Linux user password.
  </Tab>
</Tabs>

## Learn more

* [Use multiple 1Password accounts with 1Password CLI](/cli/use-multiple-accounts/)
* [Add accounts to the 1Password app](https://support.1password.com/add-account/)
* [1Password app integration security](/cli/app-integration-security/)
* [Developer quickstart](/get-started/developer-quickstart)
