Reputation:
If there is no version of OCaml already installed on the computer, running opam init
will ask you to specify a version of OCaml to install by default. That's great.
Is there a way to ask it to install the latest released version? It would make scripting the installation easier than having to look up what is the latest version each time.
Upvotes: 1
Views: 347
Reputation:
Well I got no answers so I came up with the following:
latest=$(
curl -s "https://opam.ocaml.org/urls.txt" | \
sed -n -e '/^compilers/ s/^compilers\/\([0-9.]*\)\/\1\/.*$/\1/p' | \
sort -rn | head -n1)
opam init --comp="${latest}"
Seems to work.
Upvotes: 3