# Test if Julia is installed

**URL:** <https://discourse.julialang.org/t/test-if-julia-is-installed/83703>\
**Category:** Offtopic\
**Tags:** question\
**Created:** [July 3, 2022, 2:08pm UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703 "2022-07-03T14:08:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![s3alfisc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/s3alfisc/32/35474_2.png) [@s3alfisc](https://discourse.julialang.org/u/s3alfisc)\
**Post date:** [July 3, 2022, 2:08pm UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703/1 "2022-07-03T14:08:36Z")

</div>

Hi all,

Is there a simple & OS-independent way to check if Julia is installed? Is it further possible to check ‘on-the-fly’ which Julia version is installed?

My use case: I am running tests of an R package against a Julia package and want to default to not running the tests if I find that Julia is not installed.

[Here is a related stackoverflow thread](https://stackoverflow.com/questions/49149348/check-if-python-is-installed-from-r) to test if Python is installed, from within R.

Thanks!  
Alex

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [July 3, 2022, 2:13pm UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703/2 "2022-07-03T14:13:38Z")

</div>

Pray tell me what programming language will the “test to check if Julia is installed” be running in? I hope the test is not written in Julia Language.

---

<div class="post-metadata">

**Author:** ![s3alfisc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/s3alfisc/32/35474_2.png) [@s3alfisc](https://discourse.julialang.org/u/s3alfisc)\
**Post date:** [July 3, 2022, 2:30pm UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703/3 "2022-07-03T14:30:50Z")

</div>

Hi @StevenSiew, I am afraid I don’t fully understand your question - my exact use case is to check if Julia is installed from within R.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 3, 2022, 2:35pm UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703/4 "2022-07-03T14:35:33Z")

</div>

Not sure about R but usually these things go like, check if `julia` is available on the PATH, if not check the normal installation locations for the OS that you’re on. I don’t know from the top of my head what these are but should be easy enough to find out. The version you can then get for example by running `versioninfo()` in Julia

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [July 4, 2022, 1:19am UTC](https://discourse.julialang.org/t/test-if-julia-is-installed/83703/5 "2022-07-04T01:19:11Z")

</div>

In R, try  
`system2(command="julia", args="--version")`  
and catch the error if it doesn’t exist; for example,

```julia
tryCatch(system2(command="juli1a", args="--version"), error = print("Julia not found"))

```

> **[Chapter 10 R & the Shell | Command Line Basics for R Users](https://bash-intro.rsquaredacademy.com/r-command-line.html#r)**
>
> A gentle introduction to the command line.
