Installation Guide¶
This guide will help you set up all the prerequisites for working with this Bazel tutorial.
Prerequisites Overview¶
- Bazel (6.4.0 or later)
- Git for cloning the repository
- Python 3.11+ (optional, managed by Bazel)
- Go 1.21+ (optional, managed by Bazel)
- Node.js 18+ (for Economic Dashboard UI)
Installing Bazel¶
Option 1: Using Bazelisk (Recommended)¶
Bazelisk automatically downloads and uses the correct Bazel version specified in .bazelversion.
macOS¶
Linux¶
# Using npm
npm install -g @bazel/bazelisk
# Or download binary
wget https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 -O /usr/local/bin/bazel
chmod +x /usr/local/bin/bazel
Windows¶
Option 2: Direct Bazel Installation¶
Follow the official guide for your platform: https://bazel.build/install
macOS¶
Ubuntu/Debian¶
sudo apt update && sudo apt install apt-transport-https curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel
Verify Installation¶
Installing Node.js (For Economic Dashboard)¶
The Economic Dashboard web UI requires Node.js 18 or later.
macOS¶
Linux¶
# Using NodeSource
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
Windows¶
Download from nodejs.org
Verify Installation¶
Getting a FRED API Key (For Economic Dashboard)¶
The Economic Dashboard fetches data from the Federal Reserve Economic Data (FRED) API.
- Visit https://fred.stlouisfed.org/
- Create a free account (takes 1 minute)
- Go to My Account → API Keys
- Click Request API Key
- Copy your API key
Set it in your environment:
export FRED_API_KEY=your_actual_api_key_here
# Add to your shell profile for persistence
echo 'export FRED_API_KEY=your_actual_api_key_here' >> ~/.bashrc # or ~/.zshrc
Clone the Repository¶
Verify Your Setup¶
Run the validation script to check everything is working:
This will: - Verify Bazel is installed - Check repository structure - Build all targets - Run all tests
Common Installation Issues¶
"command not found: bazel"¶
Problem: Bazel is not installed or not in your PATH.
Solution:
1. Make sure you followed the installation steps above
2. Check if Bazel is in your PATH: which bazel
3. Try using Bazelisk instead of direct Bazel installation
"Permission denied" when installing¶
Problem: Insufficient permissions to install packages.
Solution:
- Use sudo for system-wide installations (Linux/macOS)
- Run as Administrator (Windows)
- Use user-level package managers (Homebrew, npm global packages)
"Incompatible Bazel version"¶
Problem: Your Bazel version doesn't match .bazelversion.
Solution:
- If using Bazelisk: It should auto-download the correct version
- If using direct Bazel: Install the version specified in .bazelversion
- Check with: cat .bazelversion
Node.js version too old¶
Problem: Economic Dashboard requires Node.js 18+.
Solution:
# Check your version
node --version
# Upgrade using your package manager
brew upgrade node # macOS
# or use nvm
nvm install 18
nvm use 18
Next Steps¶
Once installation is complete:
- Quick Start Guide - Run your first builds
- Basic Tutorial - Learn with simple services
- Economic Dashboard - Build the full-stack app
Additional Tools (Optional)¶
Buildifier¶
Format Bazel files:
VS Code Extensions¶
- Bazel - Syntax highlighting for BUILD files
- Python - Python language support
- Go - Go language support
Remote Caching (Advanced)¶
For team collaboration, consider setting up remote caching: - Bazel Remote Cache Documentation
Need help? Open an issue