Skip to content

Installation

Before installing bwenv, ensure you have the following dependencies:

  1. Bitwarden CLI

    Terminal window
    # Install via npm (recommended)
    npm install -g @bitwarden/cli
    # Install via Homebrew (macOS)
    brew install bitwarden-cli
    # Install via Scoop (Windows)
    scoop install main/bitwarden-cli
    # Install via Snap (Ubuntu/Debian)
    sudo snap install bw
    # Install via AUR (Arch Linux)
    sudo pacman -S bitwarden-cli
    # Or download from: https://bitwarden.com/help/cli/
  2. direnv

    Terminal window
    # macOS (Homebrew)
    brew install direnv
    # Windows (Scoop)
    scoop install main/direnv
    # Ubuntu/Debian
    sudo apt install direnv
    # Arch Linux
    sudo pacman -S direnv
    # Or visit: https://direnv.net/docs/installation.html
  3. jq (JSON processor)

    Terminal window
    # macOS (Homebrew)
    brew install jq
    # Windows (Scoop)
    scoop install main/jq
    # Ubuntu/Debian
    sudo apt install jq
    # Arch Linux
    sudo pacman -S jq

After installing direnv, add it to your shell:

Terminal window
# Bash - add to ~/.bashrc
eval "$(direnv hook bash)"
# Zsh - add to ~/.zshrc
eval "$(direnv hook zsh)"
# Fish - add to ~/.config/fish/config.fish
direnv hook fish | source
Terminal window
# Clone the repository
git clone https://github.com/yourusername/bwenv.git
cd bwenv
# Install everything
make install

If you prefer manual setup:

Terminal window
# Clone and navigate
git clone https://github.com/yourusername/bwenv.git
cd bwenv
# Create directories
mkdir -p ~/.config/direnv/lib
mkdir -p ~/.local/bin
# Copy files
cp setup/bitwarden_folders.sh ~/.config/direnv/lib/
cp setup/bwenv ~/.local/bin/ # Unix/macOS
# or
copy setup\bwenv.bat %USERPROFILE%\.local\bin\ # Windows
# Make executable (Unix/macOS)
chmod +x ~/.local/bin/bwenv
chmod +x ~/.config/direnv/lib/bitwarden_folders.sh
Terminal window
make install
make setup-path # Automatically adds ~/.local/bin to PATH
Terminal window
make install
# Manually add %USERPROFILE%\.local\bin to PATH environment variable
Terminal window
make setup-path
source ~/.bashrc # or ~/.zshrc

Add to your shell config file (~/.bashrc, ~/.zshrc, etc.):

Terminal window
export PATH="$HOME/.local/bin:$PATH"

Add to PATH environment variable:

Terminal window
# PowerShell (as Administrator)
$env:PATH += ";$env:USERPROFILE\.local\bin"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::User)
Terminal window
# Test all components
bwenv test
# Check version
bwenv --version
# List available commands
make help
  1. Command not found: bwenv

    • Ensure ~/.local/bin is in your PATH
    • Run make setup-path or add manually to shell config
  2. Bitwarden CLI not working

    • Install with: npm install -g @bitwarden/cli
    • Login with: bw login
  3. direnv not activating

    • Ensure direnv hook is added to your shell config
    • Restart your terminal after adding the hook
  4. Permission denied

    • Make sure bwenv is executable: chmod +x ~/.local/bin/bwenv
Terminal window
# Show all make commands
make help
# Test installation
bwenv test
# Run with debug output
bwenv --debug=2 init

To completely remove bwenv:

Terminal window
make uninstall

This removes:

  • CLI executable from ~/.local/bin/bwenv
  • Helper script from ~/.config/direnv/lib/bitwarden_folders.sh

You may also want to remove the PATH modification from your shell config file.