# Using the Pkg REPL mode directly from the terminal

**URL:** <https://discourse.julialang.org/t/using-the-pkg-repl-mode-directly-from-the-terminal/81752>\
**Category:** General Usage\
**Tags:** question, pkg\
**Created:** [May 27, 2022, 12:07am UTC](https://discourse.julialang.org/t/using-the-pkg-repl-mode-directly-from-the-terminal/81752 "2022-05-27T00:07:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [May 27, 2022, 12:07am UTC](https://discourse.julialang.org/t/using-the-pkg-repl-mode-directly-from-the-terminal/81752/1 "2022-05-27T00:07:53Z")

</div>

I often need to start `julia`, enter the Pkg REPL to add and remove packages and then exit. I’m a lazy person, so is often too much work for me to do:

```julia
julia --project
julia> ]
pkg> add Foo Bar
pkg> rm SomePkg
julia> exit()

```

Because of this, i created a simple shell script (at `~/.julia/bin`) that allows me to use the Pkg REPL mode directly from the terminal without starting julia first, doing something and then exiting.

The script is something like:

```bash
#!/bin/bash
    
args="$@"
code="using Pkg; Pkg.REPLMode.PRINTED_REPL_WARNING[] = true; pkg\"$args\""
eval "julia --project -q --startup-file=no --history-file=no -e '$code'"

```

And then we can use like this:

```julia
script add Foo Bar
script rm SomePkg

```

Is there something “wrong” about doing things this way? Because i was thinking in create a simple `package` to automatically generate this script (with the windows version too) and then install in the `~/.julia/bin` directory.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [May 27, 2022, 12:34am UTC](https://discourse.julialang.org/t/using-the-pkg-repl-mode-directly-from-the-terminal/81752/2 "2022-05-27T00:34:06Z")

</div>

> [@\`jlpkg\` -- a command line interface to Pkg](https://discourse.julialang.org/t/jlpkg-a-command-line-interface-to-pkg/24077):
>
> Hello everyone! I’d like to announce [jlpkg](https://github.com/fredrikekre/jlpkg), a command line interface (CLI) to Julia’s package manager Pkg. jlpkg is essentially a wrapper around the [Pkg REPL mode](https://julialang.github.io/Pkg.jl/v1/repl/) so all of you are probably familiar with the commands already. How do I install the CLI? Installation is as easy as pkg\> add jlpkg julia\> import jlpkg; jlpkg.install() This will place an executable in ~/.julia/bin by default, so make sure that is on your PATH, or alternatively, symlink to it from a folder that is in your PATH. Th…

---

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [May 27, 2022, 12:42am UTC](https://discourse.julialang.org/t/using-the-pkg-repl-mode-directly-from-the-terminal/81752/3 "2022-05-27T00:42:52Z")

</div>

I didn’t know there was already a package that does that. Thanks!
