#xdg-open #launch #start

bin+lib open

Open a path or URL using the program configured on the system

48 stable releases (4 major)

5.3.3 Nov 17, 2025
5.3.2 Jan 5, 2025
5.3.1 Nov 14, 2024
5.3.0 Jul 10, 2024
1.0.2 Feb 28, 2015

#13 in Filesystem

Download history 221497/week @ 2025-10-16 261209/week @ 2025-10-23 265469/week @ 2025-10-30 289162/week @ 2025-11-06 265637/week @ 2025-11-13 315222/week @ 2025-11-20 300753/week @ 2025-11-27 314467/week @ 2025-12-04 286454/week @ 2025-12-11 260460/week @ 2025-12-18 237789/week @ 2025-12-25 287125/week @ 2026-01-01 367586/week @ 2026-01-08 385801/week @ 2026-01-15 430860/week @ 2026-01-22 459863/week @ 2026-01-29

1,702,845 downloads per month
Used in 892 crates (646 directly)

MIT license

29KB
490 lines

Crates.io cross-platform-testing

Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:

# macOS
$ open <path-or-url>
# Windows
$ start <path-or-url>
# Linux
$ xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url> || wslview <path-or-url>

To open a web browser, see the webbrowser crate, which offers functionality for that specific case.

Library Usage

Add this to your Cargo.toml

[dependencies]
open = "5"

…and open something using…

open::that("https://rust-lang.org");

…or, open something with an application of your choice

open::with("https://rust-lang.org", "firefox");

Follow this link for the API docs.

Binary Usage

This crate also implements a binary that acts like an opener itself.

cargo run 'file to open'

Credits

The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.

Dependencies

~56KB