11. REPL Mode Reference

This section describes available commands in the Pkg REPL. The REPL mode is mostly meant for interactive use, and for non-interactive use it is recommended to use the "API mode", see API Reference.

package commands

addREPL command .
add [--preserve=<opt>] pkg[=uuid] [@version] [#rev] ...

Add package pkg to the current project file. If pkg could refer to multiple different packages, specifying uuid allows you to disambiguate. @version optionally allows specifying which versions of packages to add. Version specifications are of the form @1, @1.2 or @1.2.3, allowing any version with a prefix that matches, or ranges thereof, such as @1.2-3.4.5. A git revision can be specified by #branch or #commit.

If a local path is used as an argument to add, the path needs to be a git repository. The project will then track that git repository just like it would track a remote repository online.

Pkg resolves the set of packages in your environment using a tiered approach. The --preserve command line option allows you to key into a specific tier in the resolve algorithm. The following table describes the command line arguments to --preserve (in order of strictness).

ArgumentDescription
allPreserve the state of all existing dependencies (including recursive dependencies)
directPreserve the state of all existing direct dependencies
semverPreserve semver-compatible versions of direct dependencies
noneDo not attempt to preserve any version information
tieredUse the tier which will preserve the most version information (this is the default)

Examples

pkg> add Example
pkg> add --preserve=all Example
pkg> add Example@0.5
pkg> add Example#master
pkg> add Example#c37b675
pkg> add https://github.com/JuliaLang/Example.jl#master
pkg> add git@github.com:JuliaLang/Example.jl.git
pkg> add Example=7876af07-990d-54b4-ab0e-23690620f79a
buildREPL command .
build [-v|--verbose] pkg[=uuid] ...

Run the build script in deps/build.jl for pkg and all of its dependencies in depth-first recursive order. If no packages are given, run the build scripts for all packages in the manifest. The -v/--verbose option redirects build output to stdout/stderr instead of the build.log file. The startup.jl file is disabled during building unless julia is started with --startup-file=yes.

developREPL command .
develop [--shared|--local] pkg[=uuid] ...

Make a package available for development. If pkg is an existing local path, that path will be recorded in the manifest and used. Otherwise, a full git clone of pkg is made. The location of the clone is controlled by the --shared (default) and --local arguments. The --shared location defaults to ~/.julia/dev, but can be controlled with the JULIA_PKG_DEVDIR environment variable. When --local is given, the clone is placed in a dev folder in the current project. This operation is undone by free.

Examples

pkg> develop Example
pkg> develop https://github.com/JuliaLang/Example.jl
pkg> develop ~/mypackages/Example
pkg> develop --local Example
freeREPL command .
free pkg[=uuid] ...

Free a pinned package pkg, which allows it to be upgraded or downgraded again. If the package is checked out (see help develop) then this command makes the package no longer being checked out.

generateREPL command .
generate pkgname

Create a project called pkgname in the current folder.

pinREPL command .
pin pkg[=uuid] ...

Pin packages to given versions, or the current version if no version is specified. A pinned package has its version fixed and will not be upgraded or downgraded. A pinned package has the symbol next to its version in the status list.

Examples

pkg> pin Example
pkg> pin Example@0.5.0
pkg> pin Example=7876af07-990d-54b4-ab0e-23690620f79a@0.5.0
removeREPL command .
rm [-p|--project] pkg[=uuid] ...

Remove package pkg from the project file. Since the name pkg can only refer to one package in a project this is unambiguous, but you can specify a uuid anyway, and the command is ignored, with a warning, if package name and UUID do not match. When a package is removed from the project file, it may still remain in the manifest if it is required by some other package in the project. Project mode operation is the default, so passing -p or --project is optional unless it is preceded by the -m or --manifest options at some earlier point.

rm [-m|--manifest] pkg[=uuid] ...

Remove package pkg from the manifest file. If the name pkg refers to multiple packages in the manifest, uuid disambiguates it. Removing a package from the manifest forces the removal of all packages that depend on it, as well as any no-longer-necessary manifest packages due to project package removals.

testREPL command .
test [--coverage] pkg[=uuid] ...

Run the tests for package pkg. This is done by running the file test/runtests.jl in the package directory. The option --coverage can be used to run the tests with coverage enabled. The startup.jl file is disabled during testing unless julia is started with --startup-file=yes.

updateREPL command .
up [-p|--project]  [opts] pkg[=uuid] [@version] ...
up [-m|--manifest] [opts] pkg[=uuid] [@version] ...

opts: --major | --minor | --patch | --fixed

Update pkg within the constraints of the indicated version specifications. These specifications are of the form @1, @1.2 or @1.2.3, allowing any version with a prefix that matches, or ranges thereof, such as @1.2-3.4.5. In --project mode, package specifications only match project packages, while in manifest mode they match any manifest package. Bound level options force the following packages to be upgraded only within the current major, minor, patch version; if the --fixed upgrade level is given, then the following packages will not be upgraded at all.

registry commands

registry addREPL command .
registry add reg...

Add package registries reg... to the user depot.

Julia 1.1

Pkg's registry handling requires at least Julia 1.1.

Examples

pkg> registry add General
pkg> registry add https://www.my-custom-registry.com
registry removeREPL command .
registry rm reg...

Remove package registries reg....

Julia 1.1

Pkg's registry handling requires at least Julia 1.1.

Examples

pkg> registry rm General
registry statusREPL command .
registry status

Display information about installed registries.

Julia 1.1

Pkg's registry handling requires at least Julia 1.1.

Examples

pkg> registry status
registry updateREPL command .
registry up
registry up reg...

Update package registries reg.... If no registries are specified all registries will be updated.

Julia 1.1

Pkg's registry handling requires at least Julia 1.1.

Examples

pkg> registry up
pkg> registry up General

Other commands

activateREPL command .
activate
activate [--shared] path

Activate the environment at the given path, or the home project environment if no path is specified. The active environment is the environment that is modified by executing package commands. When the option --shared is given, path will be assumed to be a directory name and searched for in the environments folders of the depots in the depot stack. In case no such environment exists in any of the depots, it will be placed in the first depot of the stack.

gcREPL command .
gc [--all]

Free disk space by garbage collecting packages not used for a significant time. The --all option will garbage collect all packages which can not be immediately reached from any existing project.

helpREPL command .
help

List available commands along with short descriptions.

help cmd

If cmd is a partial command, display help for all subcommands. If cmd is a full command, display help for cmd.

instantiateREPL command .
instantiate [-v|--verbose]
instantiate [-v|--verbose] [-m|--manifest]
instantiate [-v|--verbose] [-p|--project]

Download all the dependencies for the current project at the version given by the project's manifest. If no manifest exists or the --project option is given, resolve and download the dependencies compatible with the project.

precompileREPL command .
precompile

Precompile all the dependencies of the project by running import on all of them in a new process. The startup.jl file is disabled during precompilation unless julia is started with --startup-file=yes.

resolveREPL command .
resolve

Resolve the project i.e. run package resolution and update the Manifest. This is useful in case the dependencies of developed packages have changed causing the current Manifest to be out of sync.

statusREPL command .
status [-d|--diff] [pkgs...]
status [-d|--diff] [-p|--project] [pkgs...]
status [-d|--diff] [-m|--manifest] [pkgs...]

Show the status of the current environment. In --project mode (default), the status of the project file is summarized. In --manifest mode the output also includes the recursive dependencies of added packages given in the manifest. If there are any packages listed as arguments the output will be limited to those packages. The --diff option will, if the environment is in a git repository, limit the output to the difference as compared to the last git commit.

Julia 1.1

pkg> status with package arguments requires at least Julia 1.1.

Julia 1.3

The --diff option requires Julia 1.3. In earlier versions --diff is the default for environments in git repositories.