OPAM-REMOVE(1)

๐Ÿ’– OPAM-REMOVE(1) โ€” the opam manual, but make it cute ๐Ÿ’–

okay bestie, gather round, because this is opam-remove and it is literally the "undo" button of your opam life. it lives in the Opam Manual, section 1. let's get into it ๐Ÿซถ


โœจ NAME โœจ

opam-remove โ€” Remove a list of packages. yes that's it. that's the whole name. iconic brevity honestly ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

opam remove [OPTION]โ€ฆ [PACKAGES]โ€ฆ

like. that's the shape of it. options, then packages, go wild โœจ


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so here's the tea: this command uninstalls one or more packages that are currently installed in the compiler switch you have selected right now. that's the key part โ€” the currently selected compiler switch. if the packages you want gone are sitting in a different compiler, you can't just ask nicely from here. you gotta switch compilers first with opam switch, or hit it with the --switch flag instead. no cap.

think of this command as the exact inverse of opam-install. it's giving mirror image. ๐Ÿชž

and here's a fun lil bonus: if you hand it a directory name as a package, then packages pinned to that directory get both unpinned and removed. two-for-one. we love a multitasker ๐Ÿ’–


๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • PACKAGES โ€” a list of package names, and each one can optionally carry a version or a constraint. so like pkg, or pkg.1.0, or pkg>=0.5 โ€” all valid, all slay. you can also pass directory names that contain a package description, but they need to be explicit directories, like ./srcdir or . โ€” don't be vague about it, bestie, opam needs the receipts ๐Ÿ“

๐Ÿ’… OPTIONS ๐Ÿ’…

  • -a, --auto-remove โ€” removes all the packages that were never explicitly installed by you and that aren't needed by anything anymore. basically it sweeps up the strays ๐Ÿงน. and listen: if you want to protect a package from getting swept, run opam install <pkg> --set-root. that pins it down as a root, and auto-remove will leave it alone. this flag can also be flipped on via the $OPAMAUTOREMOVE configuration variable.
  • --destdir=DIR โ€” plot twist, this one doesn't uninstall anything at all! instead it reverts what opam install --destdir did: it removes, from the given DIR, the files corresponding to what the listed packages installed into the current switch. โš ๏ธ heads up: for this to work reliably, the package needs to still be installed at the same version that was used for install --destdir. and when you use this, the packages are not removed from the current opam switch. so your switch stays untouched, only DIR gets cleaned up.
  • --force โ€” runs the remove commands of the given packages directly, even if opam doesn't consider them installed. yeah. even then. opam trusts you. ๐Ÿซก
  • --formula=FORMULA (absent=[]) โ€” experimental, so don't @ me if it's weird. you specify a dependency formula that the solution has to verify, in addition to the switch invariant. the format is the exact same as how you write dependencies in package definition files, e.g. '"foo" {>= "1.1"}'.
  • --recursive โ€” allows recursive lookups of *.opam files. cf. --subpath too โ€” they're besties, they work together. ๐Ÿ”
  • --subpath=PATH โ€” grabs the *.opam files from the given sub directory instead of the top directory. sources then come from that targeted sub directory, and internally only that subdirectory gets copied/fetched. combine it with --recursive if you want a recursive lookup on the subpath. nesting! ๐ŸŒˆ

๐Ÿ”ฅ PACKAGE BUILD OPTIONS ๐Ÿ”ฅ

  • --assume-depexts โ€” skips the installation step for any missing system packages and just attempts to proceed with compiling the opam packages anyway. and if that install actually succeeds, opam won't nag you about those system packages ever again. only meaningful if external dependency handling is enabled โ€” otherwise it's just vibing for no reason.
  • -b, --keep-build-dir โ€” keeps the build directories around after compiling packages. same as setting $OPAMKEEPBUILDDIR to "true". hoarder energy, but make it intentional ๐Ÿ“ฆ
  • --build-doc โ€” removed in 2.1. use --with-doc instead. she's retired, bestie ๐Ÿ’€
  • --build-test โ€” removed in 2.1. use --with-test instead. also retired. rip ๐Ÿชฆ
  • -d, --with-doc โ€” builds the package documentation. note it only affects packages listed on the command-line, so no sneaky transitive doc builds. same as setting $OPAMWITHDOC (or the deprecated $OPAMBUILDDOC) to "true". ๐Ÿ“š
  • --dry-run โ€” simulates the command but doesn't actually change anything. a rehearsal. a dress rehearsal, if you will ๐ŸŽญ. this can also be set with the environment variable $OPAMDEBUG.
  • --fake โ€” registers the actions into the opam database without actually performing them. and now, the warning: this option is dangerous and likely to break your opam environment. you probably want --dry-run instead. you've been warned. ๐Ÿšจ like fr fr, do not.
  • --ignore-available-on[=PACKAGES] (default=) โ€” forces opam to mark the listed packages as available. useful for testing compatibility, but expect builds to break when you use this. also note: version constraints of those packages' dependencies are unaffected by this. so it's not a free-for-all, it's a targeted little lie ๐Ÿ™ˆ
  • --ignore-constraints-on[=PACKAGES] (default=) โ€” forces opam to ignore version constraints on all dependencies of the listed packages. again: handy for compatibility testing, but expect builds to break. and to be precise โ€” availability of the packages, version constraints on optional dependencies, and conflicts are all unaffected. only the version constraints on dependencies get ignored. same as setting $OPAMIGNORECONSTRAINTS.
  • --inplace-build โ€” when compiling a package whose source is bound to a local directory, it processes the build and install actions directly in that directory instead of in a clean copy that opam handles. only affects packages explicitly listed on the command-line. same as setting $OPAMINPLACEBUILD to "true".
  • -j JOBS, --jobs=JOBS โ€” sets the max number of concurrent jobs to use. the default is calculated from the number of cores on your machine. you can also set it with the $OPAMJOBS environment variable. parallelism, but make it yours โšก
  • --lock-suffix=SUFFIX (absent=locked) โ€” sets the locked files suffix to SUFFIX. that's it, that's the whole thing ๐Ÿ”’
  • --locked โ€” in commands that use opam files found from pinned sources, if a variant of the file with an added .locked extension exists (so like foo.opam.locked sitting next to foo.opam), then that one gets used instead. why? because it's typically useful for offering a more specific set of dependencies and reproducing similar build contexts โ€” hence the name, it "locks" things down. the lock option can generate such files for you, based on the versions of dependencies currently installed on the host. same as setting the $OPAMLOCKED environment variable. one note though: this option doesn't generally affect already pinned packages. ๐Ÿคท
  • -m MAKE, --make=MAKE โ€” removed in 2.1. use opam config set[-global] make MAKE instead.
  • --no-checksums โ€” does not verify the checksum of downloaded archives. (yes, we're skipping the vibes check on your downloads.) same as setting $OPAMNOCHECKSUMS to "true".
  • --no-depexts โ€” temporarily disables handling of external dependencies. use this when a package isn't available on your system package manager but you installed the required dependency by hand, you absolute DIY legend. it implies --assume-depexts, and it also stores the exceptions upon success, so opam remembers. ๐Ÿ› ๏ธ
  • --require-checksums โ€” rejects the installation of packages that don't provide a checksum for the upstream archives. no checksum, no entry. same as setting $OPAMREQUIRECHECKSUMS to "true". ๐Ÿšซ
  • --reuse-build-dir โ€” reuses existing build directories (the ones you kept with --keep-build-dir) instead of compiling from a fresh clone of the source. it can be faster! but it can also lead to failures if the build systems of the packages don't handle dependency upgrades well. so, speed with a side of risk ๐ŸŽฒ. same as setting $OPAMREUSEBUILDDIR to "true".
  • --show-actions โ€” calls the solver and displays the actions. performs no changes whatsoever. same as setting $OPAMSHOW. it's a look-don't-touch situation ๐Ÿ‘€
  • --skip-updates โ€” normally, when running an install, upgrade or reinstall on source-pinned packages, they get updated from their origin first. this flag disables that behaviour and keeps them at their cached version. same as setting $OPAMSKIPUPDATE.
  • -t, --with-test โ€” builds and runs the package unit-tests. only affects packages listed on the command-line. same as setting $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true". ๐Ÿงช
  • --unlock-base โ€” removed in 2.1. use --update-invariant instead.
  • --update-invariant โ€” allows changes to the set of packages set as switch base (typically, the main compiler). use with caution. this is main-character-level power and it can absolutely wreck your day if you're careless ๐Ÿ‘‘. same as setting the $OPAMUNLOCKBASE environment variable.
  • --verbose-on=PACKAGES โ€” be more verbose on specific packages. just those ones. same as setting $OPAMVERBOSE.
  • --with-dev-setup โ€” includes development tools only dependencies. ๐Ÿงฐ

๐Ÿ’– COMMON OPTIONS ๐Ÿ’–

okay bestie, listen โ€” these are the options that every single opam command shares. like, all of them. universal. iconic behaviour. learn these once and you're set for the whole toolkit ๐Ÿซถ


  • --best-effort โ€” don't bail out just because not all of your requested packages can be installed; try to install as many as possible instead. heads up tho: not every external solver supports this (recent versions of aspcud or mccs should be fine). this is the same as setting the $OPAMBESTEFFORT environment variable.
  • --cli=MAJOR.MINOR (absent=2.6) โ€” makes opam use the command-line interface syntax and semantics of MAJOR.MINOR. it's meant for anything persistent โ€” scripts, blog posts, whatever โ€” and any opam version in the same MAJOR series will behave like the MINOR release you specified. ngl, this flag didn't exist in opam 2.0, so if you need the 2.0 CLI you gotta set the OPAMCLI environment variable to 2.0 instead. no flag for you, sorry ๐ŸŽ€
  • --color=WHEN โ€” colorizes the output. WHEN has to be one of always, never or auto.
  • --confirm-level=LEVEL โ€” sets the confirmation level. LEVEL must be one of ask, no, yes or unsafe-yes. you can pass this more than once; if --yes or --no are also given, whichever --confirm-level came last wins. same thing as setting $OPAMCONFIRMLEVEL.
  • --criteria=CRITERIA โ€” specifies your user preferences for dependency solving, just for this run. it overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. for the deets on the supported language and which external solvers exist, go look at http://opam.ocaml.org/doc/External_solvers.html. and if you want a general guide to using solver preferences, that's at http://www.dicosmo.org/Articles/usercriteria.pdf โœจ
  • --cudf=FILENAME โ€” debug option, bestie: saves the CUDF requests sent to the solver into FILENAME-<n>.cudf, where <n> is the n-th call to the solver during the opam run.
  • --debug โ€” prints debug messages to stderr. equivalent to setting $OPAMDEBUG to "true".
  • --debug-level=LEVEL โ€” like --debug, but you get to pick the debug level (--debug just sets it to 1). equivalent to setting $OPAMDEBUG to a positive integer.
  • --git-version โ€” prints the git version of opam (if it's set, i.e. you're running a development version) and then exits.
  • --help[=FMT] (default=auto) โ€” shows this help in format FMT. FMT must be one of auto, pager, groff or plain. with auto, the format becomes pager or plain whenever the TERM env var is dumb or undefined.
  • --ignore-pin-depends โ€” ignores the extra pins that packages requiring pins drag in with them, whether they got pinned manually via opam pin or through opam install DIR. equivalent to setting IGNOREPINDEPENDS=true.
  • --json=FILENAME โ€” saves the results of the opam run into a computer-readable file. if the filename contains the % character, it gets replaced by an index that won't overwrite an existing file. basically the $OPAMJSON variable but as a flag.
  • --no โ€” answers no to every opam yes/no question, no prompting involved. see also --confirm-level. equivalent to setting $OPAMNO to "true".
  • --no-aspcud โ€” removed in 2.1. she's gone, she's not coming back ๐Ÿ’€
  • --no-auto-upgrade โ€” when opam configures or updates a repository written for an earlier opam version (1.2), it internally converts it to the current format. this flag disables that behaviour. note that repositories should declare their format version in a repo file at their root, otherwise they're assumed to be in the older format. and honestly? it's preferable in any case to upgrade repositories manually with opam admin upgrade [--mirror URL] when you can.
  • --no-self-upgrade โ€” opam will happily replace itself with a newer binary found at OPAMROOT/opam if one's present. this disables that behaviour. no glow-ups for you today ๐Ÿ™ˆ
  • -q, --quiet โ€” disables --verbose.
  • --root=ROOT โ€” use ROOT as the current root path. equivalent to setting $OPAMROOT to ROOT.
  • --safe, --readonly โ€” makes sure nothing gets automatically updated or rewritten. super useful when you're calling opam from completion scripts, for example. it'll fail whenever such an operation is needed; it also skips waiting on locks, skips interactive questions, and overrides the $OPAMDEBUG variable. equivalent to setting the $OPAMSAFE environment variable.
  • --solver=CMD โ€” specifies the CUDF solver used to resolve package installation problems. this is either a predefined solver โ€” this version of opam supports builtin-mccs+lp(), builtin-mccs+glpk, builtin-dummy-z3-solver, builtin-0install, aspcud, mccs, aspcud-old, packup โ€” or a custom command that should contain the variables %{input}%, %{output}%, %{criteria}%, and optionally %{timeout}%. equivalent to setting $OPAMEXTERNALSOLVER.
  • --strict โ€” fails whenever an error is found in a package definition or a configuration file. the default is to keep going silently if possible.
  • --switch=SWITCH โ€” uses SWITCH as the current compiler switch. equivalent to setting $OPAMSWITCH to SWITCH.
  • --use-internal-solver โ€” disables any external solver and uses the built-in one instead (this requires opam to have been compiled with a built-in solver). equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
  • -v, --verbose โ€” be more verbose. one -v shows all package commands; repeat it to also display commands called internally (e.g. tar, curl, patch etc.). repeating it n times is equivalent to setting $OPAMVERBOSE to "n".
  • --version โ€” shows version information.
  • -w, --working-dir โ€” whenever you update packages bound to a local, version-controlled directory, update to the current working state of their source instead of the last committed state or the ref they point to. and yes, because the source directory is copied as it is, if it isn't clean it may result in an opam build failure ๐Ÿ˜ญ. this only affects packages explicitly listed on the command-line. can also be set with $OPAMWORKINGDIR.
  • -y, --yes โ€” answers yes to all opam yes/no questions without prompting. see also --confirm-level. equivalent to setting $OPAMYES to "true".

๐ŸŒ ENVIRONMENT ๐ŸŒ

okay so opam reads a whole bunch of environment variables, bestie, and you can use them to vibe-check how it behaves. ๐Ÿ’…

Boolean variables are the drama queens โ€” set them to "0", "no", "false" or the empty string to switch them off ๐Ÿ™…โ€โ™€๏ธ, and to "1", "yes" or "true" to switch them on โœจ.

  • OPAMALLPARENS โ€” surrounds all filters with parentheses. yes, all of them. the parens get around. ๐ŸŽ€
  • OPAMASSUMEDEPEXTS โ€” check out the option --assume-depexts.
  • OPAMAUTOANSWER โ€” internal use only, bestie, don't touch, this one's not for you ๐Ÿ™ˆ
  • OPAMAUTOREMOVE โ€” look at the remove option --auto-remove.
  • OPAMBESTEFFORT โ€” see the option --best-effort.
  • OPAMBESTEFFORTPREFIXCRITERIA โ€” sets the string that must be prepended to the criteria when the --best-effort option is set, and it's expected to maximise the opam-query property in the solution. very specific, very demure. ๐Ÿ’œ
  • OPAMBUILDDOC โ€” Removed in 2.1. rip bozo ๐Ÿ˜ญ
  • OPAMBUILDTEST โ€” Removed in 2.1. also gone, also missed ๐Ÿ’€
  • OPAMCLI โ€” see the option --cli.
  • OPAMCOLOR โ€” when set to always or never, it sets a default value for the --color option. ๐ŸŽจ
  • OPAMCONFIRMLEVEL โ€” see the option --confirm-level. heads up: OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO. it's giving main character energy fr fr ๐Ÿ‘‘
  • OPAMCRITERIA โ€” specifies your user preferences for dependency solving. the default value depends on the solver version, so use config report to know the current setting. also see the option --criteria. ๐Ÿ”
  • OPAMCUDFFILE โ€” save the cudf graph to file-actions-explicit.dot.
  • OPAMCUDFTRIM โ€” controls the filtering of unrelated packages during CUDF preprocessing. โœ‚๏ธ
  • OPAMCURL โ€” you can use this to select a given 'curl' program. see OPAMFETCH for more options.
  • OPAMDEBUG โ€” see the options --debug and --debug-level.
  • OPAMDEBUGSECTIONS โ€” if set, it limits debug messages to the space-separated list of sections. sections can optionally have a specific debug level (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise just use --debug-level. ๐Ÿ›
  • OPAMDIGDEPTH โ€” defines how aggressive the lookup for conflicts is during CUDF preprocessing. it DIGS. โ›๏ธ
  • OPAMDOWNLOADJOBS โ€” sets the maximum number of simultaneous downloads. parallel downloads are slay ๐Ÿ”ฅ
  • OPAMDROPWORKINGDIR โ€” overrides packages previously updated with --working-dir on update. without this variable set, opam would keep them unchanged unless they were explicitly named on the command-line. periodt.
  • OPAMDRYRUN โ€” see the option --dry-run.
  • OPAMEDITOR โ€” sets the editor to use for opam file editing, and it overrides $EDITOR and $VISUAL. it's the final boss of editors ๐Ÿ’…
  • OPAMERRLOGLEN โ€” sets the number of log lines printed when a sub-process fails. set it to 0 to print all of them. go off, full transparency โœจ
  • OPAMEXTERNALSOLVER โ€” see the option --solver.
  • OPAMFAKE โ€” see the option --fake.
  • OPAMFETCH โ€” specifies how to download files: either wget, curl or a custom command where the variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% will be replaced. it overrides the 'download-command' value from the main config file. ๐Ÿซถ
  • OPAMFIXUPCRITERIA โ€” same as OPAMUPGRADECRITERIA, but specific to fixup and reinstall. same vibe, different context ๐Ÿ’œ
  • OPAMIGNOREAVAILABLE โ€” see the install option --ignore-available-on.
  • OPAMIGNORECONSTRAINTS โ€” see the install option --ignore-constraints-on.
  • OPAMIGNOREPINDEPENDS โ€” see the option --ignore-pin-depends.
  • OPAMINPLACEBUILD โ€” see the option --inplace-build.
  • OPAMJOBS โ€” sets the maximum number of parallel workers to run. go little workers go ๐Ÿ
  • OPAMJSON โ€” log json output to the given file (use the character % to index the files).
  • OPAMKEEPBUILDDIR โ€” see the install option --keep-build-dir.
  • OPAMKEEPLOGS โ€” tells opam to not remove some temporary command logs and some backups. this skips some finalisers and may also help to get more reliable backtraces. keeping the receipts, love that for us ๐Ÿงพ
  • OPAMLOCKED โ€” a combination of the --locked and --lock-suffix options. ๐Ÿ”’
  • OPAMLOGS โ€” logdir, sets the log directory, default is a temporary directory in /tmp.
  • OPAMMAKECMD โ€” set the system make command to use. ๐Ÿ”จ
  • OPAMMERGEOUT โ€” merge process outputs, stderr on stdout. two streams, one vibe.
  • OPAMNO โ€” answer no to any question asked, see the options --no and --confirm-level. heads up tho: OPAMNO is ignored if either OPAMCONFIRMLEVEL or OPAMYES is set. it gets overruled, no cap ๐Ÿ˜ค
  • OPAMNOAGGREGATE โ€” with opam admin check, don't aggregate packages.
  • OPAMNOASPCUD โ€” Deprecated. ๐Ÿ’€
  • OPAMNOAUTOUPGRADE โ€” disables automatic internal upgrade of repositories in an earlier format to the current one, on 'update' or 'init'.
  • OPAMNOCHECKSUMS โ€” enables the option --no-checksums when available.
  • OPAMNODEPEXTS โ€” disables system dependencies handling, see the option --no-depexts.
  • OPAMNOENVNOTICE โ€” Internal. ๐Ÿคซ
  • OPAMNOSELFUPGRADE โ€” see the option --no-self-upgrade.
  • OPAMPINKINDAUTO โ€” sets whether version control systems should be detected when pinning to a local path. Enabled by default since 1.3.0. โœจ
  • OPAMPRECISETRACKING โ€” fine grain tracking of directories. detail-oriented queen ๐Ÿ”
  • OPAMPREPRO โ€” set this to false to disable CUDF preprocessing. it's less efficient, but it might help debugging solver issues.
  • OPAMREPOSITORYTARRING โ€” internally store all non-vcs repositories as tar.gz files (by default, http repositories are stored as archive). this can be much faster on filesystems that don't cope well with scanning large trees. all operations are done in-memory, so there's no I/O for scanning the repository. ate. ๐Ÿ”ฅ
  • OPAMREQUIRECHECKSUMS โ€” enables the option --require-checksums when available (e.g. for opam install).
  • OPAMRETRIES โ€” sets the number of tries before failing downloads. we try again, bestie ๐Ÿ’ช
  • OPAMREUSEBUILDDIR โ€” see the option --reuse-build-dir.
  • OPAMROOT โ€” see the option --root. this one is automatically set by opam env --root=DIR --set-root.
  • OPAMROOTISOK โ€” don't complain when running as root. living dangerously, love that ๐Ÿ’…
  • OPAMSAFE โ€” see the option --safe.
  • OPAMSHOW โ€” see the option --show.
  • OPAMSKIPUPDATE โ€” see the option --skip-updates.
  • OPAMSKIPVERSIONCHECKS โ€” bypasses some version checks. Unsafe, for compatibility testing only. โš ๏ธ
  • OPAMSOLVERALLOWSUBOPTIMAL โ€” (default true) allows some solvers to still return a solution when they reach timeout; while the solution remains assured to be consistent, there is no guarantee in this case that it fits the expected optimisation criteria. if true, opam will continue with a warning; if false, a timeout is an error. currently only the builtin-z3 backend handles this degraded case.
  • OPAMSOLVERTIMEOUT โ€” change the time allowance of the solver. default is 60.0, set it to 0 for unlimited. note that all solvers may not support this option. โณ
  • OPAMSOLVERTOLERANCE โ€” changes the tolerance towards the solver choosing an unoptimized solution (i.e. it might pull outdated packages). typical values range from 0.0 (best solution known to the solver) to 1.0 (unoptimized solution). default is 0.0. this option is useful in case the solver can't find a solution in a reasonable time (see $OPAMSOLVERTIMEOUT). note that all solvers may not support this option.
  • OPAMSTATS โ€” Removed in 2.4. gone girl ๐Ÿ˜ญ
  • OPAMSTATUSLINE โ€” display a dynamic status line showing what's currently going on on the terminal. (one of always, never or auto) ๐Ÿ“Š
  • OPAMSTRICT โ€” fail on inconsistencies (file reading, switch import, etc.). no mess, no chaos ๐Ÿšซ
  • OPAMSWITCH โ€” see the option --switch. automatically set by opam env --switch=SWITCH --set-switch.
  • OPAMUNLOCKBASE โ€” see the install option --unlock-base.
  • OPAMUPGRADECRITERIA โ€” specifies user preferences for dependency solving when performing an upgrade. it overrides OPAMCRITERIA in upgrades if both are set. also see the option --criteria.
  • OPAMUSEINTERNALSOLVER โ€” see the option --use-internal-solver.
  • OPAMUSEOPENSSL โ€” Removed in 2.2. ๐Ÿ’€
  • OPAMUTF8 โ€” use UTF8 characters in output (one of always, never or auto). by default auto, which is determined from the locale. ๐ŸŒˆ
  • OPAMUTF8MSGS โ€” use extended UTF8 characters (camels ๐Ÿช) in opam messages. it implies OPAMUTF8. this is set by default on macOS only. iconic.
  • OPAMVALIDATIONHOOK โ€” if set, uses the %{hook}% command to validate an opam repository update.
  • OPAMVERBOSE โ€” see the option --verbose.
  • OPAMVERBOSEON โ€” see the option --verbose-on. ๐Ÿ—ฃ๏ธ
  • OPAMVERSIONLAGPOWER โ€” do not use. bestie. do NOT. ๐Ÿ™…โ€โ™€๏ธ๐Ÿ˜ญ
  • OPAMWITHDEVSETUP โ€” see the install option --with-dev-setup.
  • OPAMWITHDOC โ€” see the install option --with-doc.
  • OPAMWITHTEST โ€” see the install option --with-test.
  • OPAMWORKINGDIR โ€” see the option --working-dir.
  • OPAMYES โ€” see the options --yes and --confirm-level. OPAMYES has priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set. yes queen, say yes โœ…
  • OPAMVAR_var โ€” overrides the contents of the variable var when substituting %{var}% strings in opam files.
  • OPAMVAR_package_var โ€” overrides the contents of the variable package:var when substituting %{package:var}% strings in opam files. ๐ŸŽ€

๐Ÿฆ‹ CLI VERSION ๐Ÿฆ‹

okay so this one is important, bestie, listen up ๐Ÿซถ

All scripts and programmatic invocations of opam should use --cli in order to ensure that they work seamlessly with future versions of the opam client. and honestly, blog posts or other documentation can benefit too, because it prevents information from becoming stale. future-proofing is the vibe โœจ

Although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. so it's got your back ๐Ÿ’œ

Since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (as opam 2.0 will just ignore it), and --cli=2.1 for 2.1 (or later) versions, since an environment variable controlling the parsing of syntax is brittle. to this end, opam displays a warning if OPAMCLI specifies a valid version other than 2.0, and also if --cli=2.0 is specified. ๐Ÿ‘€

The command-line version is selected by using the --cli option or the OPAMCLI environment variable. --cli may be specified more than once, where the last instance takes precedence. and OPAMCLI is only inspected if --cli is not given. periodt. ๐Ÿ’…

๐Ÿ’€ EXIT STATUS ๐Ÿ’€

okay bestie, before we get into the numbers, there's ONE little plot twist you need to know about:

Exception alert ๐Ÿšจ โ€” the exec command does its own thing. It returns 127 if the command was not found or couldn't be executed, and otherwise it gives you back the command's own exit value. Everything below is the "as a rule" behaviour.

so, the actual codes:

  • 0 โ€” success โœจ (or true, for boolean queries).
  • 1 โ€” false. this one shows up when a boolean return value is expected, like when you're running with --check, or for queries like opam lint.
  • 2 โ€” bad command-line arguments, or command-line arguments that point at an invalid context (think: a file that doesn't follow the expected format ๐Ÿฅด).
  • 5 โ€” not found. you asked for something (package, version, repository, etc.) and it genuinely could not be found.
  • 10 โ€” aborted. the operation needed confirmation and you didn't give it. (yeah, the confirmation dialogue is load-bearing ๐Ÿ’…)
  • 15 โ€” could not acquire the locks required for the operation. ๐Ÿ”’
  • 20 โ€” there is no solution to the user request. classic cause: asking to install two incompatible packages. the math said no ๐Ÿงฎ
  • 30 โ€” error in package definition, or other metadata files. using --strict raises this error more often.
  • 31 โ€” package script error. some package operations were unsuccessful. could be an error in the packages, or an incompatibility with your system. this can be a partial error.
  • 40 โ€” sync error. some remotes couldn't be fetched from the network. this can be a partial error. ๐Ÿ›ฐ๏ธ
  • 50 โ€” configuration error. opam or system configuration doesn't allow the operation, and it needs fixing.
  • 60 โ€” solver failure. the solver failed to return a sound answer. could be a broken external solver, or an error in solver configuration.
  • 99 โ€” internal error. something went wrong, likely a bug in opam itself. so sorry bestie ๐Ÿ˜ญ
  • 130 โ€” user interrupt. SIGINT was received, generally because the user pressed Ctrl+C.

and then, hopping on a separate little list:

  • 0 on success.
  • 123 on indiscriminate errors reported on standard error.
  • 124 on command line parsing errors.
  • 125 on unexpected internal errors (bugs).

๐Ÿ“š FURTHER DOCUMENTATION ๐Ÿ“š

more reading, if you're that girl: https://opam.ocaml.org/doc.


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

the absolute icons who made this happen, no cap:

  • David Allsopp <david@tarides.com>
  • Vincent Bernardoff <vb@luminar.eu.org>
  • Raja Boujbel <raja.boujbel@ocamlpro.com>
  • Kate Deplaix <kit-ty-kate@exn.st>
  • Roberto Di Cosmo <roberto@dicosmo.org>
  • Thomas Gazagnaire <thomas@gazagnaire.org>
  • Louis Gesbert <louis.gesbert@ocamlpro.com>
  • Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
  • Anil Madhavapeddy <anil@recoil.org>
  • Guillem Rieu <guillem.rieu@ocamlpro.com>
  • Ralf Treinen <ralf.treinen@pps.jussieu.fr>
  • Frederic Tuong <tuong@users.gforge.inria.fr>

๐Ÿซถ SEE ALSO ๐Ÿซถ


๐Ÿ› BUGS ๐Ÿ›

found something cursed? check the bug reports at https://github.com/ocaml/opam/issues.


<div align="center">

and that's the whole page, bestie ๐Ÿ’– go forth and opam remove responsibly.

this gem is Opam 2.6.1, living its life as OPAM-REMOVE(1). stan forever โœจ๐Ÿ‘‘

</div>

๐Ÿ“ฆ where this page comes from