|
| 1 | +# Install the language toolchains |
| 2 | + |
| 3 | +`cstudy` builds and runs your solutions with the real toolchains of each language, and you install those yourself: neither Homebrew nor uv pulls them in with `cstudy`. This guide gives the recommended install on macOS and Linux and the command that checks it. `cstudy doctor` runs the same checks and links back here when one fails. |
| 4 | + |
| 5 | +| Toolchain | Version `cstudy doctor` accepts | Needed for | |
| 6 | +|-----------|---------------------------------|------------| |
| 7 | +| [uv and Python](#python-and-uv) | uv (any version; 0.10 or newer recommended), Python 3.13 found by `uv python find 3.13` | Required: `cstudy` and the Python practice project | |
| 8 | +| [Node.js and pnpm](#nodejs-and-pnpm) | Node 24 or newer, any pnpm (9 or newer recommended) | TypeScript | |
| 9 | +| [JDK 21](#jdk-21) | Exactly major version 21 | Java and Kotlin | |
| 10 | +| [git](#git) | Any | Optional: versioning your workspace | |
| 11 | + |
| 12 | +You need only the toolchains of the languages you practice. `cstudy doctor` still reports a missing one as `FAIL`, and exits 4, when you do not use that language. |
| 13 | + |
| 14 | +## Python and uv |
| 15 | + |
| 16 | +uv installs Python 3.13 and manages the workspace's Python project (`python/`), whose virtual environment `cstudy doctor --fix` creates with `uv sync`. Install uv with its standalone installer on either system, or with Homebrew on macOS: |
| 17 | + |
| 18 | +```bash |
| 19 | +curl -LsSf https://astral.sh/uv/install.sh | sh # macOS and Linux |
| 20 | +brew install uv # macOS, alternative |
| 21 | +``` |
| 22 | + |
| 23 | +`cstudy doctor` looks for Python 3.13 with `uv python find 3.13`, which also finds interpreters on `PATH`, such as the `python@3.13` that the Homebrew formula installs. When it finds none, install one through uv: |
| 24 | + |
| 25 | +```bash |
| 26 | +uv python install 3.13 |
| 27 | +``` |
| 28 | + |
| 29 | +Check both: |
| 30 | + |
| 31 | +```bash |
| 32 | +uv --version # uv 0.10.0 or newer |
| 33 | +uv python find 3.13 # prints the path of a Python 3.13 interpreter |
| 34 | +``` |
| 35 | + |
| 36 | +The workspace's Python project also lists `debugpy`, which only `cstudy test --debug` needs; `cstudy doctor --fix` installs it with the rest of the project. |
| 37 | + |
| 38 | +## Node.js and pnpm |
| 39 | + |
| 40 | +The TypeScript runner runs your `.ts` files directly with Node's type stripping, which needs Node 24 or newer. pnpm installs the workspace's TypeScript project (`typescript/`). We recommend [fnm](https://github.com/Schniz/fnm) to install Node, and Corepack, which ships with Node 24, to provide pnpm. |
| 41 | + |
| 42 | +1. Install fnm: |
| 43 | + |
| 44 | + ```bash |
| 45 | + brew install fnm # macOS |
| 46 | + curl -fsSL https://fnm.vercel.app/install | bash # Linux |
| 47 | + ``` |
| 48 | + |
| 49 | +2. Load fnm in your shell, by adding this line to `~/.zshrc` (for bash, use `--shell bash` in `~/.bashrc`), then open a new terminal: |
| 50 | + |
| 51 | + ```bash |
| 52 | + eval "$(fnm env --use-on-cd --shell zsh)" |
| 53 | + ``` |
| 54 | + |
| 55 | +3. Install Node 24 and make it the default: |
| 56 | + |
| 57 | + ```bash |
| 58 | + fnm install 24 |
| 59 | + fnm default 24 |
| 60 | + ``` |
| 61 | + |
| 62 | +4. Enable pnpm through Corepack. If the `corepack` command is not found, run `npm install --global corepack` first. |
| 63 | + |
| 64 | + ```bash |
| 65 | + corepack enable pnpm |
| 66 | + ``` |
| 67 | + |
| 68 | +Check both: |
| 69 | + |
| 70 | +```bash |
| 71 | +node --version # v24.0.0 or newer |
| 72 | +pnpm --version # 9.0.0 or newer |
| 73 | +``` |
| 74 | + |
| 75 | +nvm (`nvm install 24`) works as well as fnm, and on macOS `brew install node pnpm` installs both without a version manager. |
| 76 | + |
| 77 | +## JDK 21 |
| 78 | + |
| 79 | +The Java and Kotlin practice projects build with Gradle against a Java 21 toolchain, and `cstudy doctor` requires `java -version` to report major version 21: JDK 17 and JDK 25 both fail. The vendor does not matter. We recommend [SDKMAN!](https://sdkman.io) on macOS and Linux, with Eclipse Temurin. |
| 80 | + |
| 81 | +1. Install SDKMAN, then open a new terminal: |
| 82 | + |
| 83 | + ```bash |
| 84 | + curl -s "https://get.sdkman.io" | bash |
| 85 | + ``` |
| 86 | + |
| 87 | +2. List the Java builds and pick a Temurin 21 identifier, the line ending in `-tem` whose version starts with `21.`: |
| 88 | + |
| 89 | + ```bash |
| 90 | + sdk list java |
| 91 | + ``` |
| 92 | + |
| 93 | +3. Install it and make it the default `java`. The identifier below was current on October 29, 2026; use the one from your list. A plain `sdk install java` installs the newest release (25 or later), which `cstudy doctor` rejects. |
| 94 | + |
| 95 | + ```bash |
| 96 | + sdk install java 21.0.13.0+9-tem |
| 97 | + sdk default java 21.0.13.0+9-tem |
| 98 | + ``` |
| 99 | + |
| 100 | +Check it: |
| 101 | + |
| 102 | +```bash |
| 103 | +java -version # openjdk version "21.0.13" ... |
| 104 | +``` |
| 105 | + |
| 106 | +Nothing else is needed for Java or Kotlin: |
| 107 | + |
| 108 | +- **Gradle**: each workspace ships the Gradle wrapper (`jvm/gradlew`), which downloads its own Gradle on first use. `cstudy doctor` reports a missing system Gradle as `WARN`; only a maintainer who regenerates the wrapper needs one (`brew install gradle`). |
| 109 | +- **Kotlin**: the Kotlin Gradle plugin compiles the Kotlin project, and Gradle downloads it with the build, so `kotlinc` is not required. Install it with `sdk install kotlin` only if you want a Kotlin REPL. |
| 110 | + |
| 111 | +Alternatives to SDKMAN: on macOS, `brew install openjdk@21`, then follow its caveats to put it on `PATH`; on Debian and Ubuntu, `sudo apt install openjdk-21-jdk`; on Fedora, `sudo dnf install java-21-openjdk-devel`. |
| 112 | + |
| 113 | +## git |
| 114 | + |
| 115 | +git is optional: `cstudy init --git` runs `git init` in the new workspace, and `cstudy` never commits. macOS provides git with the Xcode Command Line Tools (`xcode-select --install`) or `brew install git`; on Linux, install your distribution's `git` package. |
| 116 | + |
| 117 | +## Check everything |
| 118 | + |
| 119 | +Run `cstudy doctor` to check the toolchains. In a workspace, `cstudy doctor --fix` then sets up each project: `uv sync` in `python/`, `pnpm install` in `typescript/`, and a first Gradle build in `jvm/`. |
| 120 | + |
| 121 | +```bash |
| 122 | +cstudy doctor |
| 123 | +cd ~/cstudy-workspace && cstudy doctor --fix |
| 124 | +``` |
| 125 | + |
| 126 | +[cstudy doctor](../specs/cli.md#cstudy-doctor) lists every check and its fix. |
0 commit comments