The best I've come up with so far is for pkg in vcat(["IJulia"], collect(keys(Pkg.installed()))) if !isdefined(Symbol(pkg)) info("Importing $(pkg)...") try (@eval import $(Symbol(pkg))) catch end end end
I had to manually add IJulia because it's installed site-wide (in my case). The try/catch prevents an abort if precompilation of a package fails (e.g. because Julia has to be reloaded, as happens with some packages). I found that I usually need to run this at least twice, from a clean state (empty ".julia/lib"). On Wednesday, February 17, 2016 at 12:58:10 PM UTC+1, Oliver Schulz wrote: > > Is there an easy way to precompile all installed packages, e.g. after a > `Pkg.update()`? > > This would come in handy when using a cluster of Julia machines (using an > shared home dir on a network filesystem), to ensure precompilation is done > before all machines load (and start precompiling) packages (e.g. from a > shared home directory via a network filesystem). > > Also, as precompilation of many packages can take quite a bit of time, it > would be nice to be able to choose when it happens (i.e. right now, instead > later when I may want to give a tutorial or so ;-) ). > > Sorry if this is somewhere in the docs, I didn't find anything about it. > I'd love to be able to just do `Pkg.update(precompile = true)` or so. > > > Cheers, > > Oliver > >