The OSX “open” command line tool is very useful. Use it to launch a URL or point to a folder and the web browser or Finder pops up automatically. But what about when you want to launch a particular app to handle a resource you provide? It can do that as well. Easily.
In this example I’m setting up my environment to launch several Windows remote desktop client sessions using the wonderful CoRD application. The idea is that I can put the CoRD app in a folder with a shell script and have an easily transportable launcher package to give to others – without them having to install a RDP client, etc.
Because I’m not install the CoRD application globally, the RDP protocol doesn’t get associated with the app. Therefore, when using the open command I need to explicitly tell it what application to launch it with, using the “-a” flag:
open -a /User/tyler/CoRD.app/Contents/MacOS/CoRD rdp://winserver1:3389
The benefit to using the open command here is that it won’t launch new CoRD instances, but will add them as sessions to the existing one. Likewise, open will start the process and return you to the command line – so you can list several open statements in a script and it will run them all without having to do any funky backgrounding step.
Thanks to this old OSXDaily post for pointing me in the right direction. I had given up on the command because I didn’t realise there were more options. Next time I’ll read the manual first!
- Geography + Data - July 15, 2021
- DIY Battery – Weekend Project – Aluminum + Bleach? - January 17, 2021
- It’s all about the ecosystem – build and nurture yours - May 1, 2020
- Learnings from TigerGraph and Expero webinar - April 1, 2020
- 4 Webinars This Week – GPU, 5G, graph analytics, cloud - March 30, 2020
- Diving into #NoSQL from the SQL Empire … - February 28, 2017
- VID: Solving Performance Problems on Hadoop - July 5, 2016
- Storing Zeppelin Notebooks in AWS S3 Buckets - June 7, 2016
- VirtualBox extension pack update on OS X - April 11, 2016
- Zeppelin Notebook Quick Start on OSX v0.5.6 - April 4, 2016
No Comments Yet