Skip to content

Instantly share code, notes, and snippets.

@bicycle1885
Last active January 30, 2020 04:29
Show Gist options
  • Save bicycle1885/8bcf9cb10b967af7e0950b97b803e002 to your computer and use it in GitHub Desktop.
Save bicycle1885/8bcf9cb10b967af7e0950b97b803e002 to your computer and use it in GitHub Desktop.
Set up Julia packages for system
# Install packages in system
# ==========================
# License: Public Domain
# Usage: julia setup-system.jl package1 package2 ...
# Also, don't forget to add '@system' to your LOAD_PATH like this way:
# $ env JULIA_LOAD_PATH='@:@v#.#:@system:@stdlib' julia
using Pkg
packages = ARGS
popfirst!(DEPOT_PATH) # remove user's depot
Pkg.activate("system", shared = true)
Pkg.add(packages)
Pkg.precompile()
# make cache files readable to others (see
# https://github.com/JuliaLang/julia/issues/25971)
cachedir = joinpath(DEPOT_PATH[1], "compiled")
for cachefile in eachline(`find $(cachedir) -name '*.ji'`)
chmod(cachefile, 0o666)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment