OPAM-PIN(1)

πŸ‘‘ opam-pin β€” the pinning manual (page 1 of 5)

okay bestie, welcome to the opam-pin(1) section of the Opam Manual. yes it's a real manual, yes it's long, yes we're doing this together πŸ’–

🌸 NAME 🌸

opam-pin β€” Pin a given package to a specific version or source.

✨ SYNOPSIS ✨

opam pin [OPTION]… [COMMAND] [ARG]…

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this command is how you do local customisation of the packages inside a given switch. a pin can be super chill (just force a version, that's it, no notes) or it can be a whole thing: a local, editable version of the package definition. and get this β€” you can literally manifest a brand new package into existence just by pinning a package name that doesn't exist yet. main character energy fr πŸ’…

every single customisation you could ever want is reachable through the edit subcommand, but the command line is out here making life easy for the most common case: changing the source URL of a package. because let's be honest, that's what everyone's actually doing. so like:

opam pin add PKG URL

modifies package PKG so it fetches its source from URL. and if there's a package definition chillin' inside the package's source tree, opam will use that locally. iconic.

if you pass - (or, y'know, just -), the package gets pinned without a source archive. and you can skip the package name entirely if the target is a directory that has one or more valid package definitions inside it. which is how you get to do stuff like running:

opam pin add .

straight from a source directory. convenient, right? 🫢

if PACKAGE is written in the form name.version, opam will consider the pinned package to be at version version. ⚠️ beware though: this has nothing to do with the version of the source that actually gets used for the package. they're separate things! see also the --with-version option if this is the part that's confusing you.

and the default subcommand? if there are no further arguments it's list, and otherwise it's add β€” but only if it's unambiguous.


πŸŽ€ COMMANDS πŸŽ€

with no argument, it defaults to list.

  • list β€” Lists pinned packages. If the source is a remote repository, it displays the hash representing its state. πŸ’«
  • scan DIR β€” Lists available packages to pin in directory.
  • add [PACKAGE] TARGET β€” Pins package PACKAGE to TARGET, which may be a version, a path, or a URL. PACKAGE can be omitted if TARGET contains one or more package descriptions. TARGET can be replaced by --dev-repo if a package by that name is already known, or --current if the package is already installed. If TARGET is -, the package is pinned as a virtual package, without any source. opam will infer the kind of pinning from the format (and contents, if local) of TARGET, so use --kind or an explicit URL to disable that behaviour. Pins to version control systems may target a specific branch or commit using #branch, e.g. git://host/me/pkg#testing. If PACKAGE is not a known package name, a new package by that name will be locally created. For source pinnings, the package version may be specified by using the format NAME.VERSION for PACKAGE, in the source opam file, or with edit. πŸ”₯
  • remove PACKAGES...|TARGET β€” Unpins packages PACKAGES, restoring their definition from the repository, if any. With a TARGET, unpins everything that is currently pinned to that target. bye felicia πŸ‘‹
  • edit NAME β€” Opens an editor giving you the opportunity to change the package definition that opam will locally use for package NAME, including its version and source URL. Using the format NAME.VERSION will update the version in the opam file in advance of editing, without changing the actual target. The chosen editor is determined from environment variables OPAMEDITOR, VISUAL or EDITOR, in order. πŸ“

πŸ’… OPTIONS πŸ’…

  • --all β€” When unpinning, removes all pins in the given switch.
  • --current β€” When pinning, use the currently installed version and metadata of the package: this will avoid reinstallations due to upstream metadata changes, and may also be used to keep a package that was removed upstream.
  • --dev-repo β€” Pin to the upstream package source for the latest development version
  • -e, --edit β€” With opam pin add, edit the opam file as with opam pin edit after pinning.
  • -k KIND, --kind=KIND β€” Sets the kind of pinning. Must be one of version, path, http, git, darcs, hg, none or auto. If unset or auto, is inferred from the format of the target, defaulting to the appropriate version control if one is detected in the given directory, or to path otherwise. OPAMPINKINDAUTO can be set to "0" to disable automatic detection of version control. Use none to pin without a target (for virtual packages).
  • -n, --no-action β€” Just record the new pinning status, and don't prompt for (re)installation or removal of affected packages.
  • --normalise β€” Print list of available package to pin in format name.version^url, that is comprehensible by opam pin add. Available only with the scan subcommand. An example of use is:
opam pin scan . --normalise | grep foo | xargs opam pin add
  • --recursive β€” Allow recursive lookups of *.opam files. Cf. --subpath also. πŸ”
  • -s, --short β€” Output raw lists of names, one per line, skipping any details.
  • --subpath=PATH β€” *.opam files are retrieved from the given sub directory instead of top directory. Sources are then taken from the targeted sub directory, internally only this subdirectory is copied/fetched. It can be combined with --recursive to have a recursive lookup on the subpath.
  • --with-version=VERSION β€” Set the pinning version to VERSION for named PACKAGES or packages retrieved from TARGET. It has priority over any other version specification (opam file version field, name.vers argument)). When pinning to a version, the package source from that version is used, but declared as being VERSION to opam. Using --with-version is equivalent to using --edit and adjusting the version in the package definition file. πŸ‘‘

that's part 1 bestie, don't go anywhere β€” there's more πŸ’–

✨ PACKAGE BUILD OPTIONS ✨

ok so this is where the real ✨build✨ energy lives, bestie. every flag that changes how opam builds stuff lives right here, and ngl there's a lot of them so buckle up πŸŽ€


  • --assume-depexts β€” skips the whole install step for any system packages you're missing, and just. tries to compile the opam packages anyway πŸ’€. if the install actually works out, opam won't nag you about those system packages ever again. only applies if external dependency handling is turned on in the first place, so if it's off this does literally nothing.
  • -b, --keep-build-dir β€” keeps the build directories around after packages compile, instead of yeeting them πŸ—‘οΈ. this is giving exactly the same energy as setting $OPAMKEEPBUILDDIR to "true".
  • --build-doc β€” removed in 2.1 πŸ™ˆ use --with-doc instead.
  • --build-test β€” removed in 2.1 πŸ™ˆ use --with-test instead.
  • -d, --with-doc β€” builds the package documentation πŸ“–. lowkey important: this only affects packages listed on the command-line, not their whole dependency tree. same vibe as setting $OPAMWITHDOC (or the deprecated $OPAMBUILDDOC) to "true".
  • --dry-run β€” simulates the command without actually changing anything πŸ§ͺ. a little preview, a lil dress rehearsal. you can also set this with the environment variable $OPAMDEBUG.
  • --fake β€” registers the actions into the opam database without actually performing them.
⚠️ WARNING: this option is dangerous and likely to break your opam environment. πŸ’€ like, actually. you probably want --dry-run instead. you've been warned, bestie, don't come crying to me 🫢
  • --ignore-available-on[=PACKAGES] (default=``) β€” forces opam to mark the listed packages as available βœ…. great for testing compatibility, but expect builds to break when you use this, fr fr. heads up: version constraints of the packages' dependencies are unaffected by this.
  • --ignore-constraints-on[=PACKAGES] (default=``) β€” makes opam ignore version constraints on all the dependencies of the listed packages πŸ™…. same deal, cute for compatibility testing but expect the builds to crumble. note that the availability of the packages, plus version constraints on optional dependencies and conflicts, are all unaffected. equivalent to setting $OPAMIGNORECONSTRAINTS.
  • --inplace-build β€” when you're compiling a package whose source is bound to a local directory, this 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. equivalent to setting $OPAMINPLACEBUILD to "true".
  • -j JOBS, --jobs=JOBS β€” sets the max number of concurrent jobs to use ⚑. the default is calculated from your number of cores (math girlie behavior πŸ’…). you can also set this with the $OPAMJOBS environment variable.
  • --lock-suffix=SUFFIX (absent=locked) β€” sets the locked files suffix to SUFFIX πŸ”’.
  • --locked β€” in commands that use opam files found from pinned sources, if there's a variant of the file with an added .locked extension hanging around (like foo.opam.locked sitting next to foo.opam), that one gets used instead πŸ‘‘. this is typically useful for offering a more specific set of dependencies and reproducing similar build contexts β€” hence the name, iykyk. the lock option can generate such files, based on the versions of dependencies currently installed on your host. equivalent to setting the $OPAMLOCKED environment variable. note that 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 β€” doesn't verify the checksum of downloaded archives πŸš«πŸ”. equivalent to setting $OPAMNOCHECKSUMS to "true".
  • --no-depexts β€” temporarily disables handling of external dependencies ⏸️. use this if a package isn't available on your system package manager but you installed the required dependency by hand, like a DIY queen πŸ› οΈ. implies --assume-depexts, and stores the exceptions upon success as well.
  • --require-checksums β€” rejects the installation of packages that don't provide a checksum for the upstream archives πŸš«πŸ“¦. equivalent to 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 ♻️. this can be faster, but can also lead to failures if the packages' build systems don't handle dependency upgrades well 😭. equivalent to setting $OPAMREUSEBUILDDIR to "true".
  • --show-actions β€” calls the solver and displays the actions, without performing any changes πŸ‘€. equivalent to setting $OPAMSHOW.
  • --skip-updates β€” when running an install, upgrade or reinstall on source-pinned packages, they're normally updated from their origin first. this flag disables that behaviour and keeps them at their version in cache πŸ—„οΈ. equivalent to setting $OPAMSKIPUPDATE.
  • -t, --with-test β€” builds and runs the package unit-tests πŸ§ͺ✨. only affects packages listed on the command-line. equivalent to setting $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true".
  • --unlock-base β€” removed in 2.1 πŸ™ˆ use --update-invariant instead.
  • --update-invariant β€” allows changes to the packages set as switch base (typically, the main compiler) πŸ”“. use with caution, this is main-character-takes-risks energy. equivalent to setting the $OPAMUNLOCKBASE environment variable.
  • --verbose-on=PACKAGES β€” be more verbose on specific packages πŸ—£οΈ. equivalent to setting $OPAMVERBOSE.
  • --with-dev-setup β€” includes development tools only dependencies 🧰.

✨ COMMON OPTIONS ✨

okay bestie these ones hit every single command, no matter what you're running. they're the universal vibes πŸ’–


  • --best-effort β€” the "we tried our best and that's enough" flag 🫢 don't fail the whole thing if not every package you asked for can be installed β€” just install as many as you possibly can. heads up though: not every external solver supports this (recent versions of aspcud or mccs should, so slay). it's 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. this is for literally any persistent opam usage (scripts, blog posts, etc.) β€” any opam in the same MAJOR series will behave like the MINOR release you picked. ngl there's a lil catch: this flag didn't exist back in opam 2.0, so to select the 2.0 CLI you gotta set the OPAMCLI environment variable to 2.0 instead of using this parameter. iykyk πŸŽ€
  • --color=WHEN β€” colorize 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 hand this over more than once. if --yes or --no are also given, then the value of the last --confirm-level is what counts. this is equivalent to setting $OPAMCONFIRMLEVEL.
  • --criteria=CRITERIA β€” specify your user preferences for dependency solving for this run only ✨ it overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. for the deets on the supported language and the external solvers that exist, go peep http://opam.ocaml.org/doc/External_solvers.html. and there's a whole general guide to using solver preferences at http://www.dicosmo.org/Articles/usercriteria.pdf πŸ“š
  • --cudf=FILENAME β€” debug girlies rise πŸ™ˆ this 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 β€” print debug messages to stderr. equivalent to setting $OPAMDEBUG to "true".
  • --debug-level=LEVEL β€” like --debug but you get to specify the debug level (--debug just sets it to 1). equivalent to setting $OPAMDEBUG to a positive integer.
  • --git-version β€” print the git version of opam, if it's set (i.e. you're running a development version), and bounce πŸ¦‹
  • --help[=FMT] (default=auto) β€” show this very 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 β€” ignore the extra pins that get required by packages that get pinned β€” whether that's manually through opam pin or through opam install DIR. this is equivalent to setting IGNOREPINDEPENDS=true.
  • --json=FILENAME β€” save the results of the opam run into a computer-readable file πŸ–₯️ if the filename contains the character %, it gets replaced by an index that doesn't overwrite an existing file. similar to setting the $OPAMJSON variable.
  • --no β€” answer no to every single opam yes/no question, no prompting, periodt. see also --confirm-level. equivalent to setting $OPAMNO to "true".
  • --no-aspcud β€” removed in 2.1. that's it, that's the whole note πŸ’€
  • --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: repositories should define their format version in a repo file at their root, otherwise they'll be assumed to be in the older format. and honestly it's preferable in any case to upgrade the repositories manually using opam admin upgrade [--mirror URL] when you can 🌸
  • --no-self-upgrade β€” opam will replace itself with a newer binary found at OPAMROOT/opam, if one's present. this disables that behaviour. no glow-up for opam today, bestie πŸ™…β€β™€οΈ
  • -q, --quiet β€” disables --verbose.
  • --root=ROOT β€” use ROOT as the current root path. equivalent to setting $OPAMROOT to ROOT.
  • --safe, --readonly β€” make absolutely sure nothing gets automatically updated or rewritten πŸ›‘οΈ super useful for calling from completion scripts, for example. it will fail whenever such an operation is needed; it also avoids waiting for locks, skips interactive questions, and overrides the $OPAMDEBUG variable. equivalent to setting the $OPAMSAFE environment variable.
  • --solver=CMD β€” specify the CUDF solver used for resolving package installation problems 🧩 this is either a predefined solver β€” and 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 β€” fail whenever an error is found in a package definition or a configuration file. the default is to keep going silently if it possibly can, so this is the chaotic-strict mode fr fr.
  • --switch=SWITCH β€” use SWITCH as the current compiler switch. equivalent to setting $OPAMSWITCH to SWITCH.
  • --use-internal-solver β€” disable any external solver and use the built-in one instead (this requires that opam was 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 β€” show version information. iconic.
  • -w, --working-dir β€” whenever opam updates 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're pointing to. and listen: since 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. it can also be set with $OPAMWORKINGDIR.
  • -y, --yes β€” answer yes to all opam yes/no questions without prompting, no cap. see also --confirm-level. equivalent to setting $OPAMYES to "true".

🌈 ENVIRONMENT 🌈

okay bestie, so opam literally vibes with a whole bunch of environment variables and you will be tested on them (jk, but like… know them). Quick rule before we dive in: for the boolean ones, set them to "0", "no", "false" or the empty string to turn them off, and to "1", "yes" or "true" to turn them on. πŸ’…

  • OPAMALLPARENS β€” wraps all those filters in parenthesis. cute little hug for your filters. 🫢
  • OPAMASSUMEDEPEXTS β€” see the option --assume-depexts.
  • OPAMAUTOANSWER β€” internal use only, don't touch, not your business bestie πŸ™ˆ
  • OPAMAUTOREMOVE β€” see the remove option --auto-remove.
  • OPAMBESTEFFORT β€” see the option --best-effort.
  • OPAMBESTEFFORTPREFIXCRITERIA β€” sets the string that has to be prepended to the criteria when --best-effort is set, and it's expected to maximise the opam-query property in the solution. very specific homework.
  • OPAMBUILDDOC β€” removed in 2.1. rip πŸͺ¦
  • OPAMBUILDTEST β€” removed in 2.1. also rip πŸͺ¦
  • 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. and listen: OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO.
  • OPAMCRITERIA β€” specifies user preferences for dependency solving. the default value depends on the solver version, so run config report if you wanna know the current setting. see also the option --criteria.
  • OPAMCUDFFILE β€” save the cudf graph to file-actions-explicit.dot.
  • OPAMCUDFTRIM β€” controls the filtering of unrelated packages during CUDF preprocessing.
  • OPAMCURL β€” can be used to select a given 'curl' program. see OPAMFETCH for more options.
  • OPAMDEBUG β€” see the options --debug and --debug-level.
  • OPAMDEBUGSECTIONS β€” if set, limits debug messages to a space-separated list of sections. sections can optionally have a specific debug level (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use --debug-level.
  • OPAMDIGDEPTH β€” defines how aggressive the lookup for conflicts is during CUDF preprocessing.
  • OPAMDOWNLOADJOBS β€” sets the maximum number of simultaneous downloads.
  • OPAMDROPWORKINGDIR β€” overrides packages previously updated with --working-dir on update. without this variable set, opam would keep them unchanged unless they're explicitly named on the command-line.
  • OPAMDRYRUN β€” see the option --dry-run.
  • OPAMEDITOR β€” sets the editor to use for opam file editing, and it overrides $EDITOR and $VISUAL. it said what it said πŸ’…
  • OPAMERRLOGLEN β€” sets the number of log lines printed when a sub-process fails. 0 prints all of them.
  • 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. overrides the 'download-command' value from the main config file.
  • OPAMFIXUPCRITERIA β€” same as OPAMUPGRADECRITERIA, but specific to fixup and reinstall.
  • 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.
  • 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.
  • OPAMLOCKED β€” 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.
  • OPAMNO β€” answer no to any question asked, see the options --no and --confirm-level. OPAMNO is ignored if either OPAMCONFIRMLEVEL or OPAMYES is set.
  • 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.
  • OPAMPREPRO β€” set this to false to disable CUDF preprocessing. less efficient, but it might help debugging solver issues. (debugging arc ✨)
  • 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, no I/O for scanning the repository.
  • OPAMREQUIRECHECKSUMS β€” enables the option --require-checksums when available (e.g. for opam install).
  • OPAMRETRIES β€” sets the number of tries before failing downloads.
  • OPAMREUSEBUILDDIR β€” see the option --reuse-build-dir.
  • OPAMROOT β€” see the option --root. this is automatically set by opam env --root=DIR --set-root.
  • OPAMROOTISOK β€” don't complain when running as root.
  • 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 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. another one gone 😭
  • 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.).
  • 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. overrides OPAMCRITERIA in upgrades if both are set. see also 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. implies OPAMUTF8. this is set by default on macOS only.
  • 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. that's it, that's the whole vibe πŸ™…β€β™€οΈ
  • 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.
  • 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 🌟

bestie, bestie, listen up, this one is important. all scripts and programmatic invocations of opam should use --cli so they work seamlessly with future versions of the opam client. that's not just a vibe thing β€” it's literally how you future-proof yourself. blog posts and other documentation benefit too, because it stops the information from going stale. πŸ‘‘

although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. slay.

since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (because 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. OPAMCLI is only inspected if --cli is not given.

ngl the "last one wins" thing is giving main character energy β€” the final --cli you type is the one that counts πŸ’…

πŸ’€ EXIT STATUS πŸ’€

okay bestie this part is IMPORTANT so pay attention, because exit codes are how opam talks to your shell without using words ✨

EXCEPTION ALERT 🚨 β€” the exec command is the rebel here. It returns 127 if the command was not found or couldn't be executed, and otherwise it returns the command's own exit value. Everybody else plays by the rules below, exec said "not me" πŸ’…
  • 0 β€” Success, or true for boolean queries. the good ending 🫢
  • 1 β€” False. This one shows up when a boolean return value is expected β€” like when you're running with --check, or for queries such as opam lint ✨
  • 2 β€” Bad command-line arguments, OR command-line arguments that point to an invalid context (for example a file that doesn't follow the expected format). basically you handed it something cursed 😭
  • 5 β€” Not found. You asked for something β€” a package, a version, a repository, etc. β€” and it simply wasn't there πŸ¦‹
  • 10 β€” Aborted. The operation needed confirmation and you didn't give it. no consent, no op πŸ”₯
  • 15 β€” Could not acquire the locks required for the operation. the locks said "occupied" πŸ’…
  • 20 β€” There is no solution to the user request. This can happen when you ask to install two incompatible packages, for example. girl math that doesn't math 🌸
  • 30 β€” Error in package definition, or other metadata files. Heads up: using --strict raises this error more often πŸ‘€
  • 31 β€” Package script error. Some package operations were unsuccessful. This may be an error in the packages, or an incompatibility with your system. And plot twist β€” this can be a partial error ⭐
  • 40 β€” Sync error. Could not fetch some remotes from the network. Also potentially a partial error 🌈
  • 50 β€” Configuration error. Opam or system configuration doesn't allow the operation and needs fixing. something's gotta change fr fr πŸŽ€
  • 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 due to a bug in opam itself. not us, it's literally opam 😭
  • 130 β€” User interrupt. SIGINT was received, generally because the user pressed Ctrl+C. you did this πŸ™ˆ

and rounding out the list, a lil bonus set 🎁

  • 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 πŸ“š

Need more? The docs live at https://opam.ocaml.org/doc β€” go get your enrichment bestie, it's giving academic excellence πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

the icons who built this thing, show them some respect πŸ’–

  • 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 πŸ‘€

  • opam(1) β€” the main character herself 🌟

πŸ› BUGS πŸ›

Found something broken? Check the bug reports at https://github.com/ocaml/opam/issues. don't suffer in silence, bestie, file it πŸ’…


and that's a wrap on OPAM-PIN(1) πŸŽ€ β€” this is from Opam 2.6.1 (hi queen, current version energy ✨) and the page's own footer stamp is dated, so go check the manpage for the exact date if you need it, i'm not about to make up a number fr fr 😭 ily, go pin something iconic πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from