How to see all installed packages? + a few other `Pkg` related questions

If it refers to getting the names of the installed packages in alphabetical order without using the deprecated package, then you can use something like

julia> io = IOBuffer();

julia> using Pkg; Pkg.status(; io)

julia> text = String(take!(io));

julia> lines = split(text, '\n')[2:end-1]
5-element Array{SubString{String},1}:
 "  [336ed68f] CSV v0.8.2"
 "  [a93c6f00] DataFrames v0.22.2"
 "  [59287772] Formatting v0.4.2"
 "  [713c75ef] Franklin v0.10.21"
 "  [38e38edf] GLM v1.3.11"

julia> lines_without_id = [l[14:end] for l in lines]
5-element Array{SubString{String},1}:
 "CSV v0.8.2"
 "DataFrames v0.22.2"
 "Formatting v0.4.2"
 "Franklin v0.10.21"
 "GLM v1.3.11"

this assumes quite a lot about the appearance of the output of Pkg.status. So, not very reliable, but could be useful for scripts.

2 Likes