Zero-installation OCaml development environment. Perfect for tutorials and workshops.
GitHub Codespaces runs the devcontainer on GitHub's cloud infrastructure — nothing is installed on your machine. Each user can run several codespaces simultaneously; the exact limits depend on your GitHub subscription plan. Your files are persisted across stops and restarts, but a codespace that stays inactive is automatically deleted after 30 days — push your work to a branch to keep it safe.
- Click the green "Code" button on the repository page
- Select "Codespaces" tab
- Click "Create codespace on main"
- Wait ~2-3 minutes for the environment to start
- You're ready to code!
Using the GitHub CLI:
# One-time: ensure the codespace scope is authorized
gh auth refresh -h github.com -s codespace
# Create a codespace
gh codespace create --repo tarides/ocaml-devcontainer
# Connect via SSH
gh codespace ssh
# Or open in VS Code
gh codespace code
# Or run a single command
gh codespace ssh -- dune buildHTTP 403 error? First check that
ghis authenticated with GitHub (see Authenticating with GitHub CLI). If authentication is fine, the issue is likely a missing scope — rungh auth refresh -h github.com -s codespaceto grant it, then retry.
# List your codespaces
gh codespace list
# Stop a running codespace (avoids charges)
gh codespace stop
# Delete a codespace
gh codespace deleteThe Codespace ships a single ocaml switch with OCaml 5.4.0. The ThreadSanitizer variant is available as a separate image for local/CI use but is not supported in Codespaces (TSan requires kernel parameters that Codespaces does not allow).
Pre-built images are used for fast startup. If it's taking longer than 5 minutes:
- Check GitHub Status page
- Try creating a new codespace
Codespaces have limited storage. To free space:
dune clean
opam clean -aCodespaces stop automatically after a period of inactivity (default: 30 minutes). Reconnect with gh codespace ssh; your work is preserved until the codespace is deleted.
The default Codespace has 4 cores and 8GB RAM. For larger projects, you can request more resources in Codespace settings.
See the README for installed tools, common commands, and switch details.