# Open file with system's default program

**URL:** <https://discourse.julialang.org/t/open-file-with-systems-default-program/3019>\
**Category:** General Usage\
**Tags:** guis\
**Created:** [April 3, 2017, 9:25am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019 "2017-04-03T09:25:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [April 3, 2017, 9:25am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019/1 "2017-04-03T09:25:44Z")

</div>

Is there a cross platform way to open a file with the system’s default program, basically simulating a double click on the file’s icon?  
More specifically, the type of files that will get opened this way is a video file. Instead of building all the GUI involved in making a good video player, I’d let the local system take care of it with whatever solution the user prefers. This way, if the video file can play on their machine, it’ll “play in” my program.

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [April 3, 2017, 9:30am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019/2 "2017-04-03T09:30:55Z")

</div>

> [@yakir12](#):
>
> Is there a cross platform way to open a file with the system’s default program, basically simulating a double click on the file’s icon?

No.

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [April 3, 2017, 9:32am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019/3 "2017-04-03T09:32:18Z")

</div>

OK…  
So nothing like matlab’s [winopen](https://se.mathworks.com/help/matlab/ref/winopen.html) (just found it now).

Hmmm…

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [April 3, 2017, 10:00am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019/4 "2017-04-03T10:00:34Z")

</div>

OO, no idea if this will work, but maybe something like this:

```julia
function openit(f::String)
    if is_windows()
        run(`start $f`)
    elseif is_linux()
        run(`xdg-open $f`)
    elseif is_apple()
        run(`open $f`)
    else
        error("Couldn't open $f")
    end
end

```

---

<div class="post-metadata">

**Author:** ![thilogross](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thilogross/32/16851_2.png) [@thilogross](https://discourse.julialang.org/u/thilogross)\
**Post date:** [August 11, 2020, 6:19am UTC](https://discourse.julialang.org/t/open-file-with-systems-default-program/3019/5 "2020-08-11T06:19:06Z")

</div>

Meanwhile there is a package for this.

[Default Application](https://github.com/tpapp/DefaultApplication.jl/blob/master/src/DefaultApplication.jl)

Replying to this old post because I had trouble finding the package.
