# OCaml re-install on Windows

**URL:** <https://discuss.ocaml.org/t/ocaml-re-install-on-windows/15552>\
**Category:** Learning\
**Created:** [November 4, 2024, 8:27pm UTC](https://discuss.ocaml.org/t/ocaml-re-install-on-windows/15552 "2024-11-04T20:27:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NAlec](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@NAlec](https://discuss.ocaml.org/u/NAlec)\
**Post date:** [November 4, 2024, 8:27pm UTC](https://discuss.ocaml.org/t/ocaml-re-install-on-windows/15552/1 "2024-11-04T20:27:16Z")

</div>

Hello,

My OCaml setup was broken, I decided to re-install it.

Went to windows application installation/removal and removed ‘DKML’ without any error message.

Then opened a powershell terminal and followed instructions in : [Install OCaml](https://ocaml.org/install#windows)

1. The first step was ok (winget install Git.Git OCaml.opam)

And then :

```auto
PS H:\Ocaml> opam init

<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><><><>

  In normal operation, opam only alters files within ~\AppData\Local\opam.

  However, to best integrate with your system, some environment variables
  should be set. When you want to access your opam installation, you will
  need to run:

    (& opam env) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ }

  You can always re-run this setup with 'opam init' later.

opam doesn't have any configuration options for powershell; you will have to run (& opam env) -split '\r?\n' |
ForEach-Object { Invoke-Expression $_ } whenever you change you current 'opam switch' or start a new terminal session.
Alternatively, would you like to select a different shell? [y/n] n
PS H:\Ocaml> (& opam env) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ }
[ERROR] The selected switch playground is not installed. Please choose a different one using 'opam switch <name>', or use the '--switch <name>' flag.
PS H:\Ocaml> opam switch playground
[WARNING] Removing global switch 'playground' as it no longer exists
This version of opam requires an update to the layout of C:\Users\XXX\AppData\Local\opam from version 2.1 to
version 2.2, which can't be reverted.
You may want to back it up before going further.

Continue? [y/n] y
[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of
       cores on your machine. You can restore the fixed value using:
           opam option jobs=1 --global
Format upgrade done.
[ERROR] No switch playground is currently installed. Did you mean 'opam switch create playground'?
        Installed switches are:
          - H:\OCaml\stdlib-theme
          - H:\OCaml\GenArrayIter

```

I must confess I am not comfortable with opam switch, and I feel that having a ‘playground’ switch broken is not good. Any hint before I continue ?

---

<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:** [November 4, 2024, 9:45pm UTC](https://discuss.ocaml.org/t/ocaml-re-install-on-windows/15552/2 "2024-11-04T21:45:04Z")

</div>

I doubt using your old switches will work. If you are fine removing all of your switches, I would remove C:\Users\xxx\AppData\Local\opam instead, and then rerun your opam init command.

---

<div class="post-metadata">

**Author:** ![NAlec](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@NAlec](https://discuss.ocaml.org/u/NAlec)\
**Post date:** [November 6, 2024, 6:17pm UTC](https://discuss.ocaml.org/t/ocaml-re-install-on-windows/15552/3 "2024-11-06T18:17:38Z")

</div>

Thank you. It worked !

Can you please remove my name from your post as I did in my initial post ?
