Yes. Eg I have something like
# install packages if not present
let deps = Set(map(x -> x.name, values(Pkg.dependencies())))
for name in ["Revise", "EmacsVterm"] # customize here
if name ∉ deps
@info "installing package" name
try
Pkg.add(name)
catch
@warn "could not install package" name
end
end
end
end
but it relies on experimental/unexported API, so maybe there is a better solution.