OPAM-SWITCH(1)

NAME

opam-switch - Manage multiple installation of compilers.

SYNOPSIS

opam switch [OPTION]... [COMMAND] [ARG]...

DESCRIPTION

This command allows one to switch between different compiler versions, installing the compiler if opam switch is used to switch to that compiler for the first time. The different compiler versions are totally independent from each other, meaning that OPAM maintains a separate state (e.g. list of installed packages...) for each.

See the documentation of opam switch list to see the compilers which are available, and how to switch or to install a new one.

ARGUMENTS

COMMAND
    Name of the sub-command. See the COMMANDS section for more info. If a compiler switch is given instead of an usual command, this command will switch to the given compiler. You will then need to run eval `opam config env` to update your environment variables.

OPTIONS

-A COMP, --alias-of=COMP
    The name of the compiler description which will be aliased.

-a, --all
    List all the compilers which can be installed on the system.

-b, --keep-build-dir
    Keep the build directory. This is equivalent to setting $OPAMKEEPBUILDIR to a non-empty string.

--cudf=FILENAME
    Save the CUDF request sent to the solver to FILENAME-<n>.cudf.

-d, --build-doc
    Build the package documentation. This is equivalent to setting $OPAMBUILDDOC to a non-empty string.

--dry-run
    Simply call the solver without actually performing any build/install operations.

-e TAGS, --external=TAGS
    Display the external packages associated to the given tags.

-f FILENAME, --filename=FILENAME
    The name of the file to export to/import from.

--fake
    WARNING: This option is for testing purposes only! Using this option without care is the best way to corrupt your current compiler environment. When using this option OPAM will run a dry-run of the solver and then fake the build and install commands.

-i, --installed
    List installed compiler switches only.

-j JOBS, --jobs=JOBS
    Set the maximal number of concurrent jobs to use. You can also set it using the OPAMJOBS environment variable.

--json=FILENAME
    Save the result output of an OPAM run in a computer-readable file

-m MAKE, --make=MAKE
    Use MAKE as the default 'make' command.

--no-checksums
    Do not verify the checksum of downloaded archives.This is equivalent to setting $OPAMNOCHECKSUMS to a non-empty string.

--no-switch
    Only install the compiler switch, without switching to it. If the compiler switch is already installed, then do nothing.

--no-warning
    Do not display any warning related to environment variables.

-s, --short
    Output the names separated by one whitespace instead of using the usual formatting.

-t, --build-test
    Build and run the package unit-tests. This is equivalent to setting $OPAMBUILDTEST to a non-empty string.

COMMANDS

install
    Install the given compiler. The commands fails if the package is already installed (e.g. it will not transparently switch to the installed compiler switch, as opam switch <name> does).

remove
    Remove the given compiler.

export
    Export the list installed package to a file.

import
    Install the packages from a file.

reinstall
    Reinstall the given compiler switch. This will also try reinstall the installed packages.

list
    List compilers. By default, lists installed and `standard' compilers. Use `--all' to get the list of all installable compilers. The first column displays the switch name (if any), the second one the switch state (C = current, I = installed, -- = not installed), the third one the compiler name and the last one the compiler description. To switch to an already installed compiler alias (with state = I), use opam switch <name>. If you want to use a new compiler <comp>, use opam switch <comp>: this will download, compile and create a fresh and independent environment where new packages can be installed. If you want to create a new compiler alias (for instance because you already have this compiler version installed), use opam switch <name> --alias-of <comp>. In case <name> and <comp> are the same, this is equivalent to opam switch <comp>.

show
    Show the current compiler.

COMMON OPTIONS

These options are common to all commands.

--color=WHEN (absent=auto)
    Colorize the output. WHEN must be `always', `never' or `auto'.

--compat-mode-1.0
    Compatibility mode with OPAM 1.0

--debug
    Print debug message on stdout. This is equivalent to setting $OPAMDEBUG to a non-empty value.

--git-version
    Print the git version if it exists and exit.

--help[=FMT] (default=pager)
    Show this help in format FMT (pager, plain or groff).

--no-aspcud
    Do not use the external aspcud solver, even if available.

--no-base-packages
    Do not install base packages (useful for testing purposes). This is equivalent to setting $OPAMNOBASEPACKAGES to a non-empty string.

-q, --quiet
    Be quiet when installing a new compiler.

-r ROOT, --root=ROOT (absent=~/.opam)
    Use ROOT as the current root path. This is equivalent to setting $OPAMROOT to ROOT.

--strict
    Fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible.

--switch=SWITCH
    Use SWITCH as the current compiler switch. This is equivalent to setting $OPAMSWITCH to SWITCH.

-v, --verbose
    Be more verbose. This is equivalent to setting $OPAMVERBOSE to a non-empty value.

--version
    Show version information.

-y, --yes
    Disable interactive mode and answer yes to all questions that would otherwise be asked to the user. This is equivalent to setting $OPAMYES to a non-empty string.

ENVIRONMENT VARIABLES

opam makes use of environment variables listed here.

OPAMCOLOR, when set to always or never, sets a default value for the --color option

OPAMCURL can be used to define an alternative for the 'curl' command-line utility to download files

FURTHER DOCUMENTATION

See https://opam.ocaml.org.

AUTHORS

Thomas Gazagnaire <thomas@gazagnaire.org>

Anil Madhavapeddy <anil@recoil.org>

Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>

Frederic Tuong <tuong@users.gforge.inria.fr>

Louis Gesbert <louis.gesbert@ocamlpro.com>

Vincent Bernardoff <vb@luminar.eu.org>

Guillem Rieu <guillem.rieu@ocamlpro.com>

BUGS

Check bug reports at https://github.com/OCamlPro/opam/issues.