I have been trying to make a new switch with ocaml 5.3.0, but nothing works for me. Even after an opam reinstall, using brew and without. I would clean out the .opam folder and start again, but I have a switch in there that I need. I tried everything I can think of, even after this my default switch is still on 5.1.1 $opam switch reinstall default --packages=ocaml-base-compiler.latest. I did have some switches with 5.2.0 but removed those as they were taking space. I know it used to work.
I think the problem is opam update is not doing anything.
Any ideas how I could fix this. I have a small but important to me project in ocaml. After some time building a big new project with typescript/react assisted by claude, I just want some sanity.
david@Air ī° ~ ī° opam update
david@Air ī° ~ ī° opam switch list-available
# Listing available compilers from repositories: default
# No matches found
david@Air ī° ~ ī° opam switch create 5.3.0 ocaml-base-compiler.5.3.0
[ERROR] No compiler matching `ocaml-base-compiler.5.3.0' found, use `opam switch list-available' to see what is
available, or use `--packages' to select packages explicitly.
ā david@Air ī° ~ ī° opam switch
# switch compiler description
ā default ocaml-base-compiler.5.1.1,ocaml-options-vanilla.1 default
finch ocaml-base-compiler.4.14.2 finch
forms ocaml-base-compiler.5.1.1 forms
Iām no expert but the obvious next debugging steps are to try opam switch list-available
with --debug
in case that prints anything useful. Then to see what is in opam repository list --all
. Oh - presumably you are on a Mac, judging by your prompt?
Thanks for your kind reply.
I am not in a huge rush, the world is waking up and i am about to go to bed, but any ideas appreciated. Bound to be something obvious, just not to me.
Here are the results of that.
david@Air ī° ~ ī° opam switch list-available --debug
00:00.158 CLI Parsing CLI version 2.4
00:00.158 GSTATE LOAD-GLOBAL-STATE @ /Users/david/.opam
00:00.159 RSTATE LOAD-REPOSITORY-STATE @ /Users/david/.opam
00:00.164 CACHE(repository) Loaded /Users/david/.opam/repo/state-1DC2C051.cache in 0.001s
00:00.164 RSTATE Cache found
# Listing available compilers from repositories: default
# No matches found
david@Air ī° ~ ī° opam repository list --all
# Repository # Url # Switches(rank)
platform-cache file:///Users/david/.opam/plugins/ocaml-platform/cache/repo
david@Air ī° ~ ī° opam update
david@Air ī° ~ ī°
Hmm. Why donāt you have a default repository of ocaml.org listed?
I donāt know. I am busy elsewhere, when I get a chance I will move ~.opam to something else and try a fresh reinstall. Maybe I can reinstal the packages on the one switch I care about.
Thanks for your kindness
David
The empty list of repositories is suspicious. Have you ever ran opam repository remove default --all
or something similar? What does cat ~/.opam/repo/repos-config
say?
A tiny suggestion: you donāt need to change anything about your current OPAM configuration to test out new installations. I routinely install opam in a ānonstandard locationā so I can have multiple opam installs ā typically so I can test out a new opam (e.g. 2.4.1) without disturbing the existing one (e.g. 2.3.0). So I just set the OPAMROOT
env var:
export OPAMROOT=/home/chet/Hack/Opam/GENERIC
or
export OPAMROOT=/home/chet/Hack/Opam-2.3.0/GENERIC
then I just make sure opam
is in the path, and I can run opam init
and itāll take effect below that OPAMROOT
.
1 Like
I probably did something like āopam switch remove defaultā, then āopam switch create default 5.3.0ā in my effort to get this sorted. Anyway, it was troubling before that.
david@Air ī° ~ ī° cat ~/.opam/repo/repos-config
opam-version: ā2.0ā
repositories:
āplatform-cacheā
{āfile:///Users/david/.opam/plugins/ocaml-platform/cache/repoā}
david@Air ī° ~ ī°
Thanks for that. That could solve my problem.
David
I had some time and fixed the problem by moving all .opam folders, reinstalling opam from scratch. Onward.
Thanks for your kind responses.
Regards
David