Julia Language Packages Install, use, and remove a registered package


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:

julia> Pkg.update()

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:

julia> Pkg.add("Currencies")

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:

julia> Pkg.test("Currencies")

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 Pkg.rm function:

julia> Pkg.rm("Currencies")

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 Pkg.resolve:

julia> rm(Pkg.dir("Currencies"); recursive=true)

julia> Pkg.resolve()