# A few beginner's questions

**URL:** <https://discourse.julialang.org/t/a-few-beginners-questions/15347>\
**Category:** New to Julia\
**Created:** [September 22, 2018, 6:11pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347 "2018-09-22T18:11:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![threadedblue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/threadedblue/32/19247_2.png) [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Post date:** [September 22, 2018, 6:11pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/1 "2018-09-22T18:11:07Z")

</div>

I am getting started with Julia. I have two questions.

wrt the directory: .julia/packages/\*

1. How do packages get created in said directory? What did I do to cause this?
2. How (best practice) should they be removed/deleted?

Thanks so much

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [September 22, 2018, 6:17pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/2 "2018-09-22T18:17:54Z")

</div>

The source tree of a package version is put there when you install that version of the package, e.g. by doing `]` (to enter the Pkg REPL mode) and then do `pkg> add Example`. You can delete them any time you want to, but of course, if some project was using a version then it won’t work anymore. It is easy to reinstall all the package versions that are used by a project by activating it (e.g. by starting Julia as `julia --activate` in that project’s directory) and doing `pkg> instantiate`. If you want to clean up versions of packages that are no longer used by any project, you can do `pkg> gc`.

---

<div class="post-metadata">

**Author:** ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Post date:** [September 23, 2018, 9:15am UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/3 "2018-09-23T09:15:20Z")

</div>

@StefanKarpinski: My understanding is that using “gc” simply clears the compiled version but not the pkgs in packages folder.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 23, 2018, 9:25am UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/4 "2018-09-23T09:25:53Z")

</div>

```julia
(v1.0) pkg> ?gc
  Deletes packages that cannot be reached from any existing environment.

(v1.0) pkg> gc
    Active manifests at:
        `/home/pfitzseb/.julia/testenv/Manifest.toml`
        `/home/pfitzseb/.julia/environments/v1.1/Manifest.toml`
        `/home/pfitzseb/.julia/environments/v1.0/Manifest.toml`
        `/home/pfitzseb/.julia/environments/v0.7/Manifest.toml`
   Deleted /home/pfitzseb/.julia/packages/AbstractPlotting/ZHerD: 27.585 MiB
   Deleted /home/pfitzseb/.julia/packages/Atom/WSz3k: 64.383 KiB
   Deleted /home/pfitzseb/.julia/packages/Atom/jJn7Y: 62.389 KiB
...

```

---

<div class="post-metadata">

**Author:** ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Post date:** [September 23, 2018, 9:30am UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/5 "2018-09-23T09:30:24Z")

</div>

@pfitzseb: thanks for clarification.

---

<div class="post-metadata">

**Author:** ![threadedblue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/threadedblue/32/19247_2.png) [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Post date:** [September 24, 2018, 2:34pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/6 "2018-09-24T14:34:57Z")

</div>

Thanks for the responses so far. Let me ask these two questions:

Why the error when I register my package? (See below)  
How do I do a recompile? (Again, see below)  
I am trying to get a development work flow going.

I create a project.  
**(v1.0) pkg\> generate XYZ**  
I make it a git repository  
**cd XYZ**  
**git init**  
I register it.  
**(v1.0) pkg\> add /XYZ**  
I get an error ( see way below for full output ). Why the error?  
I don’t see a package in .julia/packages. I do get an entry in .julia/environment/Manifest.toml

I going to be developing this package so I do…  
**(v1.0) pkg\> dev /XYZ**  
I get an entry in .julia/compiled.  
I use my package  
**julia\> using XYZ**  
I run something.  
**julia\> XYZ.go()**  
**Ave Mundus!**  
Correct!  
I make a change. I add an exclamation point  
**…**  
**go() = print(“Ave Mundus!!”)**  
**…**  
I try simply running again. I try **pkg\> update XYZ**. I try **pkg\> build XYZ**. No matter what, I still don’t get my added exclamation point. Clearly, I am missing something and I’ll bet it is embarrassingly simple. But what?

Thanks

The Output  
**Updating** registry at `~/.julia/registries/General`  
**Updating** git-repo `https://github.com/JuliaRegistries/General.git`  
**Updating** git-repo `/Users/gcr/d4mWorkspace/XYZ`  
**ERROR:** GitError(Code:EUNBORNBRANCH, Class:Reference, reference ‘refs/heads/master’ not found)  
#=  
Why the above error?  
=#  
Stacktrace:

[1] **head(** ::LibGit2.GitRepo **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/LibGit2/src/error.jl:101**

[2] **branch(** ::LibGit2.GitRepo **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/LibGit2/src/LibGit2.jl:368**

[3] **#handle\_repos\_add!#31(** ::Bool, ::Nothing, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Types.jl:633**

[4] **#handle\_repos\_add!** at **./none:0** [inlined]

[5] **#add\_or\_develop#13(** ::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:54**

[6] **(::getfield(Pkg.API, Symbol(“#kw##add\_or\_develop”)))(** ::NamedTuple{(:mode,),Tuple{Symbol}}, ::typeof(Pkg.API.add\_or\_develop), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} **)** at **./none:0**

[7] **do\_add!(** ::Dict{Symbol,Any}, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Symbol,Any} **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:633**

[8] **#invokelatest#1(** ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N **)** at **./essentials.jl:686**

[9] **invokelatest(** ::Any, ::Any, ::Vararg{Any,N} where N **)** at **./essentials.jl:685**

[10] **do\_cmd!(** ::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:542**

[11] **#do\_cmd#30(** ::Bool, ::Function, ::REPL.LineEditREPL, ::String **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:507**

[12] **do\_cmd** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:503** [inlined]

[13] **(::getfield(Pkg.REPLMode, Symbol(“##41#44”)){REPL.LineEditREPL,REPL.LineEdit.Prompt})(** ::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:842**

[14] **#invokelatest#1** at **./essentials.jl:686** [inlined]

[15] **invokelatest** at **./essentials.jl:685** [inlined]

[16] **run\_interface(** ::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2261**

[17] **run\_frontend(** ::REPL.LineEditREPL, ::REPL.REPLBackendRef **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1029**

[18] **run\_repl(** ::REPL.AbstractREPL, ::Any **)** at **/Users/osx/buildbot/slave/package\_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191**

[19] **(::getfield(Base, Symbol(“##720#722”)){Bool,Bool,Bool,Bool})(** ::Module **)** at **./logging.jl:311**

[20] **#invokelatest#1** at **./essentials.jl:686** [inlined]

[21] **invokelatest** at **./essentials.jl:685** [inlined]

[22] **macro expansion** at **./logging.jl:308** [inlined]

[23] **run\_main\_repl(** ::Bool, ::Bool, ::Bool, ::Bool, ::Bool **)** at **./client.jl:330**

[24] **exec\_options(** ::Base.JLOptions **)** at **./client.jl:242**

[25] **\_start()** at **./client.jl:421**

---

<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:** [September 24, 2018, 2:40pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/7 "2018-09-24T14:40:11Z")

</div>

See [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

A package is not automatically reloaded after you make changes. You probably want to look at [Revise.jl](https://github.com/timholy/Revise.jl), which does exactly this.

---

<div class="post-metadata">

**Author:** ![threadedblue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/threadedblue/32/19247_2.png) [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Post date:** [September 24, 2018, 3:09pm UTC](https://discourse.julialang.org/t/a-few-beginners-questions/15347/8 "2018-09-24T15:09:57Z")

</div>

@fredrikekre

Ah, Revise does the trick. Thanks

I would still appreciate at if anyone can help me understand the aforementioned error.
