Run bash command from link in browser

1

1

Is there a way to run an arbitrary command on OSX by clicking a link in the browser?

As you know, there are certain types of hyperlinks that launch certain applications with a specified action, for instance:

  • Clicking a link opens iTunes and takes you to a view where you can buy a given song or app
  • Clicking a magnet link opens your default torrent app and adds it for download

These ask you if you want to allow the action to be performed and whether you want to remeber your choice.

What I'm looking for is to be able to click a link that triggers an action that, in turn, runs:

$ curl -fsSL [link for my personal use] | bash

This may be by opening Terminal or whatever, as long as it runs and I'm able to see the output; however I understand this may not be possible due to security reasons.

Is there any way to do this?

Gerard

Posted 2015-06-09T22:13:01.500

Reputation: 383

1I'm far from an expert in these kinds of matters, and don't even have a mac - but often these link triggers are a result of a "MIME" association. Depending on the control you have on the web page, you may be able to push a unique "Content-Type" header and then configure an associated action in your browser. – davidgo – 2015-06-09T23:23:34.380

Building on @davidgo's idea: http://superuser.com/questions/421792/how-to-associate-mime-type-with-a-handler-in-os-x

– wojtow – 2015-06-16T21:12:10.557

No answers