# How to test if package is installed

**URL:** <https://discourse.julialang.org/t/how-to-test-if-package-is-installed/3508>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 4, 2017, 6:18am UTC](https://discourse.julialang.org/t/how-to-test-if-package-is-installed/3508 "2017-05-04T06:18:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [May 4, 2017, 6:42am UTC](https://discourse.julialang.org/t/how-to-test-if-package-is-installed/3508/2 "2017-05-04T06:42:26Z")

</div>

The second one is very similar to how Pkg itself does it, so I would not say it’s hackish (unless you believe the approach of `Pkg` itself to be hackish). If you want to match exactly how Pkg determines if a package is installed, use

```julia
isinstalled(pkg::AbstractString) =
    pkg != "METADATA" && pkg != "REQUIRE" && pkg[1] != '.' && Pkg.cd(isdir, pkg)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-test-if-package-is-installed/3508)._
