Launch & Run Multiple Instances of Any Application in Mac OS X

May 11, 2011 - 10 Comments

Run Multiple Instances of Any Application in Mac OS X

You can run multiple instances of any application in Mac OS X with a little command line magic. Using the ‘open’ command to launch GUI apps from the Terminal, we can run a new instance of any app, even if it is already running.

In the simplest form, we just point open to the application with the -n flag. For a practical example, we’ll use the Safari browser:

open -n /Applications/Safari.app/

This will launch a new instance of Safari, even if Safari is already open. You can repeat this command to launch as many instances of the app that you want running.

Instead of repeating the command over and over again though, let’s make it even easier to launch multiple instances of the app though. What if you want to launch five new instances of Safari? Assuming you’re using bash, we’ll use this command:

n=5 ; for (( c=1; c<=n; c++)) ; do open -n /Applications/Safari.app/ ; done

Now that's a bit of a complicated string to type over and over again, so we'll make it easier by creating an alias in your .bash_profile:

First you need to open .bash_profile in a text editor, nano is nice and easy:

nano ~/.bash_profile

Now paste this into a new line (assuming there's other aliases in there from our recent tips or otherwise), just make sure everything is on a single line:

alias safarix5='n=5 ; for (( c=1; c<=n; c++)) ; do open -n /Applications/Safari.app/ ; done'

Save changes to .bash_profile by hitting Control+O and hitting return

I named the alias 'safarix5' for Safari X 5, since that string launches 5 instances of Safari, but you can call it whatever you want. If you wanted to run Safari in 10 different instances, it's just a matter of changing the variable 'n' like so:

alias safarix10='n=10 ; for (( c=1; c<=n; c++)) ; do open -n /Applications/Safari.app/ ; done'

You can change the application to anything you want, just remember that each running instance of an app consumes the full amount of resources for that app. Web and app developers should be particularly happy with this trick, but there are plenty of other uses as well.

If you enjoyed this, check out more command line tips and tricks.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: David Mendez in Command Line, Mac OS X, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. Cromagnon Man says:

    Nice tip! I saw it on Facebook but this is great for using different Dropbox accounts at the same time too

  2. PeTIK says:

    Linker for OSX, alpha version
    start multiple application instance ;)

    http://petikteam.blogspot.com/2010/02/linker4osx-how-to-start-multiple.html

  3. Jack Frost says:

    Doesn’t seem to work on Chrome. It dies immediately.

  4. meh says:

    Another good option is to make it into a service so you can just right-click on the file icon that you want to open with a new instance of the default program.

    http://lifehacker.com/#!5766390/how-to-open-two-instances-of-an-application-in-os-x

  5. albinoz says:

    I will test thanks for

  6. […] this method you can actually run concurrent instances of apps without using the traditional ‘open -n’ command […]

  7. Stewart says:

    You need to also add that if the file name contains a space you will be required to enclose that name in quotes: i.e. open -n /Applications/”Xilisoft Video Converter Ultimate 6.app”/ .

  8. Mareo Raft says:

    The following is slightly simpler. Let’s say I wanted to open the application Safari.

    Open Terminal, type the command
    [code]open -na Safari[/code]

    Explanation: The -n option is for “new” or “new instance”. The -a option tells your computer you are opening an application, so that the path (usually /Applications/) and the extensions (.app) are no longer needed.

  9. Brian says:

    Hi,

    Great tip. I have multiple iTunes libraries. How can I open iTunes and make OS X think I am holding the ‘option’ key so I can select a library?

    Thanks

  10. Anthony Tanas says:

    Thanks, works great. I prefer the simplicity of just using the open -n command on the rare occasions I need two versions.

    A coworker suggested that it could be a problem though for apps that use iCloud. Any concern with having two copies of the Notes app open for instance? I wouldn’t think so but he suggested it was a real problem.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates