# Programmatic installation of Julia packages?

**URL:** https://discourse.julialang.org/t/programmatic-installation-of-julia-packages/85207
**Category:** Tooling
**Tags:** question, package
**Created:** [August 2, 2022, 11:00pm UTC](https://discourse.julialang.org/t/programmatic-installation-of-julia-packages/85207 "2022-08-02T23:00:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![wsphd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsphd/32/38482_2.png) [@wsphd](https://discourse.julialang.org/u/wsphd)
#### Post date: [August 2, 2022, 11:00pm UTC](https://discourse.julialang.org/t/programmatic-installation-of-julia-packages/85207/1 "2022-08-02T23:00:44Z")

</div>

In R, I can use install.packages() to install packages programmatically, Similarly, in Python I can use mamba, conda, or pip.

I know how to install Julia packages from the REPL (press “]” to go into Package handler). How do I, however, install Julia packages programmatically (either within Julia, or a .jl, or from a linux-alike shell)?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [August 2, 2022, 11:23pm UTC](https://discourse.julialang.org/t/programmatic-installation-of-julia-packages/85207/2 "2022-08-02T23:23:00Z")

</div>

In an interactive session, the equivalent of `] add StaticArrays` via a string macro is as follows.

```julia
using Pkg
pkg"add StaticArrays"

```

More generally, you can do

```julia
using Pkg
Pkg.add("StaticArrays")

```

See [12. API Reference · Pkg.jl](https://pkgdocs.julialang.org/v1/api/#General-API-Reference) for further details.

If you would like a command line interface, see

> **[GitHub - fredrikekre/jlpkg: A command line interface (CLI) for Pkg, Julia's...](https://github.com/fredrikekre/jlpkg)**
>
> A command line interface (CLI) for Pkg, Julia's package manager. - GitHub - fredrikekre/jlpkg: A command line interface (CLI) for Pkg, Julia's package manager.

Additionally, you may be interested in supplying a Project.toml and Manifest.toml. If you `Pkg.activate` a folder containing these files, and then `Pkg.instantitate` the environment will be reproduced.

See the documentation on environments:

[https://pkgdocs.julialang.org/v1/environments/](https://pkgdocs.julialang.org/v1/environments/)
