Command-line interface for Overleaf — Sync, manage, and compile LaTeX projects from your terminal.
Work with Overleaf projects directly from your command line. Edit locally with your favorite editor, version control with Git, and sync seamlessly with Overleaf's cloud compilation.
Full Overleaf command-line access:
- 📋 List all your Overleaf projects
- ⬇️ Pull project files to local directory for offline editing
- ⬆️ Push local changes back to Overleaf
- 🔄 Sync bidirectionally with smart conflict detection
- 📄 Compile PDFs using Overleaf's remote compiler
- 📦 Download individual files or full project archives
- 📤 Upload files to projects
- 📊 Output compile artifacts (
.bbl,.log,.auxfor arXiv submissions)
Perfect for:
- Editing LaTeX in your preferred text editor (Vim, VS Code, Emacs, etc.)
- Version control with Git while using Overleaf's compiler
- Automating workflows and CI/CD pipelines
- Offline work with periodic sync
- Collaborative projects where some prefer CLI, others prefer web
brew tap aloth/tap
brew install olcliInstall globally to use the olcli command anywhere:
npm install -g @aloth/olcliOr use with npx without installation:
npx @aloth/olcli listGet your session cookie from Overleaf.com:
- Log into overleaf.com
- Open Developer Tools (F12 or Cmd+Option+I) → Application/Storage → Cookies
- Copy the value of
overleaf_session2
Store it with olcli:
olcli auth --cookie "your_session_cookie_value"Tip: The cookie stays valid for weeks. Just refresh it when authentication fails.
olcli listSee all your Overleaf projects with IDs and last modified dates.
Download any project to work on it locally:
olcli pull "My Thesis"
cd My_Thesis/Now you can edit .tex files with your preferred editor (Vim, VS Code, Emacs, etc.).
# Edit files locally with your favorite editor
vim main.tex
# Push changes back to Overleaf
olcli push
# Or sync bidirectionally (pull + push in one command)
olcli syncYour collaborators can continue using the Overleaf web editor — changes sync seamlessly.
Use Overleaf's remote compiler from the command line:
olcli pdfThe compiled PDF downloads automatically to your current directory.
All commands auto-detect the project when run from a synced directory (contains .olcli.json).
| Command | Description |
|---|---|
olcli auth |
Set session cookie |
olcli whoami |
Check authentication status |
olcli logout |
Clear stored credentials |
olcli list |
List all projects |
olcli info [project] |
Show project details and file list |
olcli pull [project] [dir] |
Download project files to local directory |
olcli push [dir] |
Upload local changes to Overleaf |
olcli sync [dir] |
Bidirectional sync (pull + push) |
olcli upload <file> [project] |
Upload a single file |
olcli download <file> [project] |
Download a single file |
olcli zip [project] |
Download project as zip archive |
olcli compile [project] |
Trigger PDF compilation |
olcli pdf [project] |
Compile and download PDF |
olcli output [type] |
Download compile output files |
olcli check |
Show config paths and credential sources |
Work offline in your favorite editor, push when ready, compile remotely:
olcli pull "Research Paper"
cd Research_Paper
vim introduction.tex
git commit -am "Update intro"
olcli push
olcli pdfKeep your LaTeX project in Git while using Overleaf's compiler:
olcli pull "My Thesis" thesis
cd thesis
git init
git add .
git commit -m "Initial import from Overleaf"
# Daily workflow
vim chapters/methods.tex
git commit -am "Draft methods section"
olcli sync # Sync with Overleaf
olcli pdfIntegrate Overleaf compilation into CI/CD:
#!/bin/bash
olcli auth --cookie "$OVERLEAF_SESSION"
olcli pull "Automated Report"
./generate-data.py > tables/results.tex
olcli push
olcli pdf -o report-$(date +%Y-%m-%d).pdfDownload the .bbl file for arXiv submissions:
olcli output bbl --project "My Paper"
# Downloads: bblList all available compile output files:
olcli output --list
# Available output files:
# aux output.aux
# bbl output.bbl
# blg output.blg
# log output.log
# ...- Downloads all files from Overleaf
- Skips local files modified after last pull (won't overwrite your changes)
- Use
--forceto overwrite local changes
- Uploads files modified after last pull
- Use
--allto upload all files - Use
--dry-runto preview changes
- Pulls remote changes
- Preserves local modifications (local wins if newer)
- Pushes local changes to remote
- Use
--verboseto see detailed file operations
Credentials are stored in (checked in order):
OVERLEAF_SESSIONenvironment variable.olauthfile in current directory- Global config:
~/.config/olcli-nodejs/config.json(macOS/Linux)
For project-specific credentials, create .olauth in your project directory:
s%3AyourSessionCookieValue...
# Initial setup
olcli pull "PhD Thesis" thesis
cd thesis
# Daily workflow
vim chapters/introduction.tex
olcli sync
olcli pdf -o draft.pdfolcli pdf "Conference Paper" -o paper.pdfolcli download main.tex "My Project"cd my-project
olcli upload figures/diagram.pngfor proj in $(olcli list --json | jq -r '.[].name'); do
olcli zip "$proj" -o "backups/${proj}.zip"
donecd my-paper
olcli output bbl -o main.bbl
olcli zip -o arxiv-submission.zipIf you get authentication errors, your session cookie may have expired. Get a fresh one from the browser and run olcli auth again.
Check the Overleaf web editor for detailed error logs. Common issues:
- Missing packages
- Syntax errors in
.texfiles - Missing bibliography files
Contributions are welcome! Please open an issue or submit a pull request.
MIT © Alexander Loth
