# Installing OCaml on a Windows dev drive

**URL:** <https://discuss.ocaml.org/t/installing-ocaml-on-a-windows-dev-drive/17904>\
**Category:** Ecosystem\
**Tags:** windows\
**Created:** [March 18, 2026, 1:25pm UTC](https://discuss.ocaml.org/t/installing-ocaml-on-a-windows-dev-drive/17904 "2026-03-18T13:25:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amaro](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@amaro](https://discuss.ocaml.org/u/amaro)\
**Post date:** [March 18, 2026, 1:25pm UTC](https://discuss.ocaml.org/t/installing-ocaml-on-a-windows-dev-drive/17904/1 "2026-03-18T13:25:05Z")

</div>

Is there a way to install OCaml on a [Windows dev drive](https://learn.microsoft.com/en-us/windows/dev-drive/)?

I mean, by default OCaml installs itself on `C:\Users`, and from what I read, a dev drive needs to be configured as D:, E:, etc. I didn’t see a way to mount a subfolder on another drive.

---

<div class="post-metadata">

**Author:** ![jbeckford](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jbeckford/32/3027_2.png) [@jbeckford](https://discuss.ocaml.org/u/jbeckford)\
**Post date:** [March 18, 2026, 9:36pm UTC](https://discuss.ocaml.org/t/installing-ocaml-on-a-windows-dev-drive/17904/2 "2026-03-18T21:36:59Z")

</div>

You can set `OPAMROOT` as a system or user environment variable in the Control Panel. Then close your Command Prompt / Powershell, and then do `opam init`.

On my Windows PC I have a `Y:` dev drive and I point all the package managers to it:

| Key | Value |
| --- | --- |
| NUGET\_PACKAGES | `Y:\user\beckf\packages\nuget` |
| OPAMROOT | `Y:\user\beckf\packages\opam` |
| CARGO\_HOME | `Y:\packages\cargo` |
| MAVEN\_OPTS | `-Dmaven.repo.local=Y:\packages\maven` |
| npm\_config\_cache | `Y:\packages\npm` |
| PIP\_CACHE\_DIR | `Y:\packages\pip` |
| VCPKG\_DEFAULT\_BINARY\_CACHE | `Y:\packages\vcpkg` |

Most of that is documented at [Set up a Dev Drive on Windows 11 | Microsoft Learn](https://learn.microsoft.com/en-us/windows/dev-drive/#storing-package-cache-on-dev-drive) (OCaml is not on it, but they accept PRs).
