How to completely remove a package

I tried removing the pacakge with rm packagename, which seems to have de-installed the package, but I see that it is still there in \.julia\packages\
Last time I manually remove a directory from \.julia\packages\, it cause a horrible mess so I would like to avoid that. Is there a way to completely remove a package, or will things keep adding up?

There is

import Pkg
Pkg.gc()

which will look at all recently active manifests and see what packages are not in use and can be removed (removed as in deleted from the system).

You could also set the period by

julia> using Dates
julia> Pkg.gc(collect_delay=Dates.Second(1))
1 Like

Combining Pkg.gc(collect_delay=Dates.Second(0)) with rm packagename beforehand did the trick. thanks