|Download and install the given registered package.|
|Check out the given branch for the given registered package. |
|Clone the Git repository at the given URL as a package.|
|Get the location on disk for the given package.|
|Force the package to remain at the given version. |
|Remove the given package from the list of required packages.|
After finding an official Julia package, it is straightforward to download and install the package. Firstly, it's recommended to refresh the local copy of METADATA:
This will ensure that you get the latest versions of all packages.
Suppose that the package we want to install is named
Currencies.jl. The command to run to install this package would be:
This command will install not only the package itself, but also all of its dependencies.
If the installation is successful, you can test that the package works properly:
Then, to use the package, use
julia> using Currencies
and proceed as described by the package's documentation, usually linked to or included from its README.md file.
To uninstall a package that is no longer needed, use the
Note that this may not actually remove the package directory; instead it will merely mark the package as no longer required. Often, this is perfectly fine — it will save time in case you need the package again in the future. But if necessary, to remove the package physically, call the
rm function, then call
julia> rm(Pkg.dir("Currencies"); recursive=true) julia> Pkg.resolve()
Sometimes, the latest tagged version of a package is buggy or is missing some required features. Advanced users may wish to update to the latest development version of a package (sometimes referred to as the "master", named after the usual name for a development branch in Git). The benefits of this include:
However, there are many drawbacks to running the latest development version:
To check out the latest development branch of a package named
JSON.jl, for example, use
To check out a different branch or tag (not named "master"), use
However, if the tag represents a version, it's usually better to use
Note that a version literal is used here, not a plain string. The
Pkg.pin version informs the package manager of the version constraint, allowing the package manager to offer feedback on what problems it might cause.
To return to the latest tagged version,
Some experimental packages are not included in the METADATA package repository. These packages can be installed by directly cloning their Git repositories. Note that there may be dependencies of unregistered packages that are themselves unregistered; those dependencies cannot be resolved by the package manager and must be resolved manually. For example, to install the unregistered package
Then, as is usual, use
using to use the package: