Error with opam init

Hello all

I’m hitting an error when installing OCaml on Windows 10. The bash script runs successfully and I proceed to the next step of running opam init mingw "https://github.com/fdopen/opam-repository-mingw.git" --comp 4.06.1+mingw64 --switch 4.06.1+mingw64

This step fails with the messages shown below. Note: this happens with the pre-compiled version and with the GUI install version too. Does anyone have any tips for how to resolve this?

Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg
    command on your system.
  - you won't be able to use darcs repositories unless you install the darcs
    command on your system.

opam: unknown option `--autorun', did you mean `-a' ?
Usage: opam config [OPTION]... [COMMAND] [ARG]...
Try `opam config --help' or `opam --help' for more information.
[ERROR] Initialisation failed
# opam-version    1.3.0~dev (9fc27413c08030d909802dcdfb6e63b75d9dd762)
# os              win32
Cannot remove C:/OCaml64/home/snip/.opam/repo/mingw (error 1).
opam: unknown option `--autorun', did you mean `-a' ?
Usage: opam config [OPTION]... [COMMAND] [ARG]...
Try `opam config --help' or `opam --help' for more information.
opam: unknown option `--autorun', did you mean `-a' ?
Usage: opam config [OPTION]... [COMMAND] [ARG]...
Try `opam config --help' or `opam --help' for more information.
# opam-version    1.3.0~dev (9fc27413c08030d909802dcdfb6e63b75d9dd762)
# os              win32
Cannot remove C:/OCaml64/home/snip/.opam (error 1).Fatal error: exception # opam-version    1.3.0~dev (9fc27413c08030d909802dcdfb6e63b75d9dd762)
# os              win32
Cannot remove C:\OCaml64\tmp\opam-snip-508 (error 1).

From the command prompt, what is the output of reg query "HKCU\Software\Microsoft\Command Processor" /v AutoRun?

Thank you for your time, the output of that command is here:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
        AutoRun    REG_SZ    opam config env --autorun

No problem. That’s what I feared - where did you get that opam binary from? I would delete that registry value (same command but with delete rather than query).

It looks as though you’ve picked up opam from more than one source - the --autorun parameter is part of my Windows fork (but that part is not merged upstream yet) and fdopen’s mingw repository doesn’t use that opam any more. Your best bet for opam on Windows at the moment is either using the Linux Subsystem or using fdopen’s installer at https://fdopen.github.io/opam-repository-mingw/installation/

Ah thank you! I have been fiddling with too many things over too long a time to remember where anything came from but it started with trying to get F* running.

I’ve been trying to get a fresh start and deleting this registry entry is what I was missing. It works now, thanks again!