A command line interface (CLI) for Pkg, Julia's package manager.
Author fredrikekre
64 Stars
Updated Last
1 Year Ago
Started In
May 2019


Build Status

A command line interface (CLI) to Pkg, Julia's package manager.


Output of jlpkg --help:

$ jlpkg --help
       jlpkg - command line interface (CLI) to Pkg, Julia's package manager

       jlpkg [--options] <pkg-cmds>...

           Commands to the Pkg REPL mode. Execute the `help` command
           (e.g. `jlpkg help`) to list all available commands, and execute
           `jlpkg ?cmd` (or `jlpkg help cmd`) to show detailed help for a
           specific command. See https://julialang.github.io/Pkg.jl/v1/repl/
           for documentation of the syntax and the available commands.

           Set the home project/environment.
           Equivalent to Julia's `--project` switch.

           Specify path to, or command for, the Julia executable.
           Overrides the executable set when installing the CLI.

           Allow the subsequent commands to update package registries.

           Enable Pkg's offline mode (requires Julia 1.5 or later).

           Show jlpkg and julia version numbers.

           Show this message.

       · Add the Example package to the package environment located at `path`:
           $ jlpkg --project=path add Example

       · Update package registries and add the JSON package:
           $ jlpkg --update add JSON

       · Show the help for the `add` Pkg REPL command:
           $ jlpkg ?add


There are number of ways to install jlpkg:

Installation from Julia

First install jlpkg from the Pkg REPL:

pkg> add jlpkg

then install the command line interface with

julia> import jlpkg; jlpkg.install()

For available configuration, see the documentation for jlpkg.install, e.g. from the Julia REPL:

help?> jlpkg.install

    jlpkg.install(; kwargs...)

Install the command line interface.

Keyword arguments:

 · command: name of the executable command, defaults to jlpkg.

 · julia: path to julia executable, defaults to the path of the current running julia.

 · destdir: writable directory (available in PATH) for the executable,
   defaults to ~/.julia/bin.

 · julia_flags: vector with command line flags for the julia executable,
   defaults to ["--color=yes", "--startup-file=no", "-q", "--compile=min", "-O0"]

 · force: boolean used to overwrite any existing commands.

Install shell completion

jlpkg supports Bash shell completion. This can be installed by using jlpkg.install_completion:

julia> jlpkg.install_completion()

For available configuration, see the documentation for jlpkg.install_completion:

help?> jlpkg.install_completion

    jlpkg.install_completion(; kwargs...)

Install shell completion for jlpkg. Currently only bash completion is supported.

Keyword arguments:

 · command: name of the executable command to be completed, defaults to jlpkg.

 · destdir: writable directory to place the completion file in, defaults to ~/.bash_completion.d.

 · rcfile: shell startup file to source the completion file in, defaults to ~/.bashrc.
   If you want to handle sourcing yourself, use rcfile=nothing.

 · force: boolean used to overwrite an existing completion file.

Installation from tarball

It is possible to download and extract a prebuilt script with default settings. For example, to download the latest release you can run the following

$ curl -fsSL https://github.com/fredrikekre/jlpkg/releases/download/v1.3.2/jlpkg-v1.3.2.tar.gz | \
  tar -xzC /usr/local/bin

This will extract the executable script jlpkg and place it in /usr/local/bin. You can of course replace /usr/local/bin with any writable folder in your PATH. When using the prebuilt script it is assumed that julia is also in your PATH.

The Bash completion file can also be downloaded from the repo. For example:

$ curl -fsSL -o ~/.bash_completion.d/jlpkg-completion.bash \

Make sure to source this file in your shell startup file. For example, add the following to ~/.bashrc:

# Bash completion for jlpkg
if [[ -f ~/.bash_completion.d/jlpkg-completion.bash ]]; then
    . ~/.bash_completion.d/jlpkg-completion.bash

Installation using asdf

It is possible to install jlpkg using the asdf version manager using the asdf-jlpkg plugin. See the plugin README for instructions.