Andrea MoroIl blog di

Open multiple instances of an application in OS X

Nobody wants to run multiple instances of a program at the same time, and I don’t want it either. And Mac OS X is doing a great job for this as by default it is designed to handle software in a single-instance launching allowing the user to have it only once at a time.  As long as the software has a nice “Window” function and it supports floating windows, meaning that you can align the windows in two different places and makes comparisons if required, this is absolutely fine.
I’ve seen the majority of the Mac software I need to make this possible. However, there are particular applications – normally Java/based – that don’t make this possible, and this really made me mad.

So, I did run a couple of searches and here we go, a pretty neat solution that will make the word “instance” at the top an easy game. How? This requires you to be confident in using the Terminal application, and it is not complicate at all, because all you have to type is in

open -n -a "APPLICATION NAME"

Replacing the “Application name” via the quotes with the application you want to run twice.

For the sake of your comprehension, this command tells the system to open a new instance (the “-n” flag) of an application (the “-a” flag) that is the given name in quotes.

Now, all the time you need the second application running, you have to jump in your terminal window and remember how to do it. Kind of of a pain if you are not very literate with your Mac.

Is something faster I can do?

Of course there is, and probably it would make your life easier. All you have to do is using the AppleScript Editor. I know! AppleScript can be scary, but trust me, after this little exercise below you will find this very cool.

Launch the AppleScript, which is nestled in your Applications folder. Once on the screen, you’ll see an Untitled editing window; copy and paste the following lines into the window:

do shell script "open -n " 

Next, make your default Finder (I currently use PathFinder) the active window and go to the Application folder. Start a drag and drop operation clicking on the icon of the app you want to open twice and drop into the AppleScript window just before the closing quote.

In my case, I chose ScreamingFrog and what I have obtained was

do shell script "open -n /Applications/Screaming\\ Frog\\ SEO\\ Spider.app"

Please note that if you have an application that contains spaces, you have to “unescape” the space and make sure your Mac OS X will interpret it correctly. So that’s the reason in the path above you see a double backslash prior every single space. Failing in doing this, at the time you will compile your application, AppleScript will prompt you an error message.

Now, click on the Scripts menu at the top of your screen, and choose Compile, or if you prefer hit Command-K on your keyboard. Then choose Save from the File menu, and be sure to change the file type to “Application.”, and also make sure to save the app with a different name, otherwise when you will be opening the app via Spotlight you may not recognise which is the “multiple instance” version from the normal one.

You can save the “application” on your Desktop for now, which I assume if the place where you spend the majority of your time.

Once you’ve saved the new app, you can double click on it (or use spotlight as aforementioned) and get Mac OS X launch multiple instances of the app as many time as you please. 

That’s it for now. Of course bear in mind that the more app you have, the more your memory tend to downgrade, so make sure to not saturate your Mac performances by launching your app too much.

I look forward to hearing any comments you may have.

 



Leave a Reply

gosq