How can I find out which packages are installed in the global environment?

If I have launched Julia with:

julia --project

I can find out the packages of the project with:

using Pkg
keys(Pkg.project().dependencies)

But how can I find out which packages are installed globally?

This should work:

let projectpath = Pkg.project().path
    basepath, _ = splitdir(projectpath)
    Pkg.activate()
    globaldependencies = keys(Pkg.project().dependencies)
    Pkg.activate(basepath)
    globaldependencies
end

But also notice:

help?> Pkg.project
  Pkg.project()::ProjectInfo

  This feature is considered experimental.
  ...
1 Like
julia> using ShareAdd

julia> ShareAdd.info("@v1.11")
  @v1.11
   => ["BasicAutoloads", "Revise", "ShareAdd"]

1 Like