# Folder Navigation for Activating Environments in Package Manager

**URL:** <https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502>\
**Category:** Package Management\
**Created:** [August 8, 2022, 8:33pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502 "2022-08-08T20:33:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liamfdoherty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamfdoherty/32/24516_2.png) [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)\
**Post date:** [August 8, 2022, 8:33pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502/1 "2022-08-08T20:33:51Z")

</div>

I am a Mac user. Let’s say I have a package under development, `Foo.jl`, that is present under the folder `~/github/Foo.jl` on my machine (here the tilde is the home directory, standard for Macs). I am writing another script elsewhere, say under `~/scripts/script.jl` that needs to include the package `Foo.jl`.

To make sure I don’t get an error when trying `using Foo`, I would like to activate the environment for the package, which I would normally do with `] activate .` while in the highest level of the package. I know that you can specify a path to activate environments other than the standard Julia one and whichever folder you are currently in, but running `] activate "~/github/Foo.jl"` creates a new environment _inside_ of `~/scripts/~/github/Foo.jl`, which is obviously not my intention.

Is there a way to express that I am giving the absolute path of the directory, i.e., to recognize that the `~` character means “home directory”?

I know, of course, that I can do a series of `../../..` for as long as it takes to get back to `~`, but I’m sure it’s understandable that this can become cumbersome the farther I am from `~`. I could also do `; cd ~/github/Foo.jl` and then `] activate .`, but I am hoping there is something a little nicer than that.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [August 8, 2022, 8:53pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502/2 "2022-08-08T20:53:37Z")

</div>

Hi, I believe that must methods do not expand the `~` by default (maybe to enforce cross-platform consistency).

Ex:

```julia
julia> abspath("~") == abspath(homedir())
false

julia> abspath(expanduser("~")) == abspath(homedir())
true

```

You can use `joinpath(homedir(), "github", "Foo.jl")` instead.

---

<div class="post-metadata">

**Author:** ![josePereiro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josepereiro/32/17322_2.png) [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Post date:** [August 8, 2022, 8:55pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502/3 "2022-08-08T20:55:56Z")

</div>

Also it is maybe better for you to use the `Pkg` API not the REPL.

```julia
import Pkg
Pkg.activate(here_a_path)

```

---

<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:** [August 8, 2022, 9:19pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502/4 "2022-08-08T21:19:29Z")

</div>

> [@liamfdoherty](#):
>
> but running `] activate "~/github/Foo.jl"` creates a new environment _inside_ of `~/scripts/~/github/Foo.jl`, which is obviously not my intention

When you quote the path it is taken literally, and e.g. `~` is not expanded (this behavior is likely the same in your shell). If you use

```julia
] activate ~/github/Foo.jl

```

it should work.

---

<div class="post-metadata">

**Author:** ![liamfdoherty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamfdoherty/32/24516_2.png) [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)\
**Post date:** [August 8, 2022, 9:27pm UTC](https://discourse.julialang.org/t/folder-navigation-for-activating-environments-in-package-manager/85502/5 "2022-08-08T21:27:24Z")

</div>

That was silly of me, it works now! Thanks so much!
