Getting Started with PyBritive
Overview
PyBritive is the official Britive command-line interface. It lets you check out and check in access profiles, retrieve temporary cloud credentials, and automate Britive workflows directly from your terminal.
What you’ll learn:
- How to install PyBritive on your machine
- How to connect PyBritive to your Britive tenant
- How to authenticate and verify your identity
Before You Begin
- Python 3.9 or higher installed — run
python3 --versionto check - Access to a Britive tenant
- At least one working Resource or Application profile available for checkout
- A terminal (macOS/Linux) or PowerShell (Windows)
Install and Authenticate
Install PyBritive
Install PyBritive using pip:
pip install pybritiveVerify the installation:
pybritive --versionYou should see the installed version number, for example:
pybritive, version 2.x.xFix: command not found after install
If your shell cannot find the pybritive command after installing, your pip executable directory is not in your PATH. Run this to find the correct path:
python3 -m site --user-baseAdd the bin directory from that output to your PATH. For example, if the output is /Users/yourname/Library/Python/3.11, add this to your ~/.zshrc or ~/.bashrc:
export PATH="$PATH:/Users/yourname/Library/Python/3.11/bin"Then reload your shell:
source ~/.zshrcConfigure your tenant
Tell PyBritive which Britive tenant to connect to:
pybritive configure tenantWhen prompted, enter your tenant name — the subdomain of your Britive URL. See Finding Your Tenant Name if you’re not sure what to enter.
Tenant: acmeTo configure multiple tenants (for example, a production and a staging tenant), run the command again and provide an alias:
pybritive configure tenant --alias stagingLog in
Authenticate with your Britive tenant:
pybritive loginThis opens a browser window for interactive login. Complete the authentication flow — including any MFA your organization requires — then return to your terminal.
Your credentials are stored locally at ~/.britive/pybritive.credentials.encrypted by default.
Verify
Confirm you are authenticated by printing your identity:
pybritive userThis returns details about the authenticated user, confirming the CLI is connected and your session is active.
Troubleshoot
| Symptom | Cause | Fix |
|---|---|---|
command not found: pybritive | pip bin directory not in PATH | Follow the PATH fix under Install PyBritive |
No tenant configured | configure tenant not run | Run pybritive configure tenant |
| Browser does not open during login | Default browser not detected | Use pybritive login --browser chrome (or firefox, safari) |
Login succeeds but pybritive user fails | Token expired or wrong tenant | Run pybritive logout then pybritive login |
Next Steps
- Listing Your Access — view available profiles, applications, and secrets
- Check Out and Check In — request and return temporary access credentials