# Security and usability improvement for webbrowser.open() on macOS: Replace osascript with /usr/bin/open

**URL:** <https://discuss.python.org/t/security-and-usability-improvement-for-webbrowser-open-on-macos-replace-osascript-with-usr-bin-open/106943>\
**Category:** Ideas\
**Created:** [April 12, 2026, 10:02pm UTC](https://discuss.python.org/t/security-and-usability-improvement-for-webbrowser-open-on-macos-replace-osascript-with-usr-bin-open/106943 "2026-04-12T22:02:19Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![zware](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/zware/32/58_2.png) [@zware](https://discuss.python.org/u/zware)\
**Post date:** [May 15, 2026, 3:02am UTC](https://discuss.python.org/t/security-and-usability-improvement-for-webbrowser-open-on-macos-replace-osascript-with-usr-bin-open/106943/5 "2026-05-15T03:02:05Z")

</div>

I think the major difference is in the name: `webbrowser.open` should always _open_ a _webbrowser_. Java’s `...Desktop.browse` still evokes a browser, but the “desktop” in the name at least hints that it might not be a web browser that gets opened.

However, I do agree that we should have a standard API for “do the system default for this URI”, but I’m not sure where it should live. `webbrowser` seems out of place regardless of the function name because the whole point is that we don’t necessarily want to open a web browser. The functionality most reminds me of `os.startfile`, which has always been a Windows-specific way to launch a _file_ the way the OS wants, but `os` doesn’t strike me as a great place either (though it may still my front-runner of the options I’ve come up with) and I’m not sure what we would call the function – `os.starturi`? 🫤 I wonder about something like `urllib.launch(uri)`, but that feels different from anything else in `urllib`, even though that package is specifically about dealing with URIs.

For some further reading, see also [Support for `file://` urls in webbrowser.open](https://discuss.python.org/t/support-for-file-urls-in-webbrowser-open/81612) and [webbrowser.open with file: URLs may launch editor instead of browser (gh-128540)](https://github.com/python/cpython/issues/128540) which have also recently changed `webbrowser` on macOS. Also tangentially related is this old proposal to [Add `shutil.open` (gh-47427)](https://github.com/python/cpython/issues/47427) as a cross-platform `os.startfile`.

---

_[View the full topic](https://discuss.python.org/t/security-and-usability-improvement-for-webbrowser-open-on-macos-replace-osascript-with-usr-bin-open/106943)._
