# \`opam install\` except for actually installing?

**URL:** <https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915>\
**Category:** Ecosystem\
**Tags:** opam\
**Created:** [December 5, 2022, 6:38pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915 "2022-12-05T18:38:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [December 5, 2022, 6:38pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/1 "2022-12-05T18:38:55Z")

</div>

I’ve searched the documentation, and haven’t found this, hence my asking the question:

Is there a way to use opam to build a package, but _not_ install it? That is, no external effects whatsoever ? Just do everything required to build it? Of course, that would mean that if the package has prereqs that aren’t installed, then the build fails (and you need to do a `install --deps-only` beforehand).

This would be nice for, y’know, testing packages nearly-completely.

---

<div class="post-metadata">

**Author:** ![bnguyenvanyen](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bnguyenvanyen](https://discuss.ocaml.org/u/bnguyenvanyen)\
**Post date:** [December 6, 2022, 1:12pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/2 "2022-12-06T13:12:41Z")

</div>

There are opam plugins opam-build and opam-test that sort of do this. See: [GitHub - kit-ty-kate/opam-build: Experimental opam plugin](https://github.com/kit-ty-kate/opam-build)

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [December 6, 2022, 5:40pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/3 "2022-12-06T17:40:27Z")

</div>

looking at the doc for `opam-build`, it appears that it builds a local switch? I ran it, and that’s what seemed to be happening (and no flags to disable it)? That’s actually not what I want. B/c I have N “global” switches, and in each I want to do the build (in order to test for version-compatibility). Among other things, I’d like to run all these installs in parallel (8-way AMD Ryzen, gotta use it up 😉

Is there a way to tell opam-build to use the current switch ?

---

<div class="post-metadata">

**Author:** ![bnguyenvanyen](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bnguyenvanyen](https://discuss.ocaml.org/u/bnguyenvanyen)\
**Post date:** [December 9, 2022, 9:58am UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/4 "2022-12-09T09:58:42Z")

</div>

Yes sorry, that’s what I meant by “sort of”. I agree that that would be nice. Even more with a way to test different compilers / etc. I guess @kit-ty-kate can say more about the plugin.

---

<div class="post-metadata">

**Author:** ![Leonidas](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/leonidas/32/4039_2.png) [@Leonidas](https://discuss.ocaml.org/u/Leonidas)\
**Post date:** [December 9, 2022, 2:04pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/5 "2022-12-09T14:04:18Z")

</div>

Another option is to use ocaml-ci, which builds with different versions and checks that it builds which is nice because it also makes sure that the dependencies are at least correct enough to contain all required code to build on “someone else’s machine”. Currently it is not in general availability state but you can probably get added to the list of approved users.

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [December 9, 2022, 7:24pm UTC](https://discuss.ocaml.org/t/opam-install-except-for-actually-installing/10915/6 "2022-12-09T19:24:57Z")

</div>

The problem with opam-ci is that it does a large pile of installs for prereqs, and that takes time. The nice thing about “do an install but skip the last step of actually copying files into place” is that it’s so much cheaper. But otherwise, yes, opam-ci is what I’d like. Trying to get some part of the benefit without the cost.
