Is it possible to make an opam "sandbox"?
Asked Answered
S

1

3

I have two ocaml projects being compiled with ocaml 4.02.1. Is there a way to create separate opam installations for each project instead of having both projects install their dependencies in the global 4.02.1 opam switch?

Southernly answered 24/12, 2014 at 18:25 Comment(0)
A
7

In opam you can have several installations of the same compiler:

opam switch -A 4.02.1 proj1
opam switch -A 4.02.1 proj2

will create two separate independent stacks for each project. You may also find these commands useful:

opam switch export
opam switch import
Annam answered 24/12, 2014 at 18:38 Comment(2)
If you alias the system compiler, OPAM also does a "fast switch" that doesn't require reinstalling everything. So you could do opam switch -A system proj1, assuming that your system compiler is 4.01.0Rimma
The -A option was removed in opam 2.1 . For now, we should use the following command to create a switch: opam switch create <name> <compiler version>.Urias

© 2022 - 2024 — McMap. All rights reserved.