Cross-platform browser launcher for Ruby?

24 September, 2008

In Python, you can do this:

import webbrowser
webbrowser.open_new(<a href=""></a>)

and lo! it will open your default browser at that URL whether you are on Windows, Linux or Mac.

I can’t find the same functionality in Ruby anywhere. I notice that even Shoes has its own native C implementation (check out the shoes_browser_open method in each of the platform-specific files in

Does this really mean I’ll have to implement my own? Or have I simply missed the bundled one? Google really has not been my friend on this.

See other posts tagged with general ruby python and other posts made in September 2008.


Nolan Eakins
25 September, 2008 at 19:28

Steal the code from Shoes, toss it up on GitHub, and blog about it. 🙂

25 September, 2008 at 22:13

Yes, that *is* my plan so far 🙂

Gareth Simpson
30 September, 2008 at 21:30

Here, I tested stack overflow with it.

30 September, 2008 at 22:09

Wow, impressive. I really wasn’t sure if StackOVerflow was worth it, that appears to answer my questions.

For what it’s worth, I’d already implemented the second solution for Windows-only.

Did you actually try it on your mac?