Launch & 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.
I’ve got a macbook pro since February, and I’m stunned by the amount of nerdy tricks you have to pull out to get it working in a somewhat decent fashion. The competition is far more user friendly.
Very few Mac users need to run two instances of the same app, most would just open a new window or file in the same app, so it should not be surprising that to run concurrent .app packages it is more complex than clicking a dock icon.
But how do you run two instances of the same .exe file in Windows without duplicating the exe? You can’t. So much for the competition.
William, I know I’m grave digging by a lot, but I thought I’d make sure you weren’t still living in the delusion that duplicating an exe would have to be done in windows. It’s actually as simple as right clicking on the running app in the task bar and clicking on it’s name in the context window, and they’re even rooted to the same taskbar icon as well. Heaps easier than mac and a LOT more organized!
Even simpler…shift-click on the icon in Windows. Been there forever. Macs are just full of bad, but I guess when you need to make an OS to cater to the lowest common denominator…
I’m curious how I might modify this script to get around the Yosemite/iTunes launch bug that prevents one from opening iTunes through a standard double click on the app icon. Currently I found this fix for launching iTunes when one encounters this particular erroe:
~ MiniMe$ /Applications/iTunes.app/Contents/MacOS/iTunes ; exit;
My ultimate goal is to be able to have two instances (or more) of iTunes open so I can get around the idiotic disabling of having multiple playlists open in iTunes. I figure if iTunes will no longer allow me to have multiple playlists open simultaneously, perhaps having multiple versions of the app open will permit me to achieve this goal of multiple playlists – or at least two side by side so I can drag and drop between playlists.
It still stuns me that a basic feature of the MacOS from its infancy (multiple finder windows) would be disabled as a capability in a modern version of their software.
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.
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
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.
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”/ .
[…] this method you can actually run concurrent instances of apps without using the traditional ‘open -n’ command […]
I will test thanks for
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
Doesn’t seem to work on Chrome. It dies immediately.
Linker for OSX, alpha version
start multiple application instance ;)
http://petikteam.blogspot.com/2010/02/linker4osx-how-to-start-multiple.html
Nice tip! I saw it on Facebook but this is great for using different Dropbox accounts at the same time too