This question is addressed in OPAM FAQ [1], but both solutions provided do not work with OPAM v.1.2.2, as env
and exec
commands are both unknown. How can I run a single command from the different switch?
You linked to the FAQ for opam 2.0. Here it is for opam 1.2: https://opam.ocaml.org/doc/FAQ.html#Can-I-work-on-different-switches-at-the-same-time-in-different-shells
🐫 Can I work on different switches at the same time in different shells ?
Yes. Use one of:
eval $(opam config env --switch <switch>) # for the current shell opam config exec --switch <switch> -- <command> # for one command
This only affects the environment.