1/28/13

MacMost Now 819: Running Multiple Instances Of the Same App On Mac

For most apps you can simply open multiple windows or tabs to edit or view separate documents. But some apps only let you have one window open. Sometimes when using apps like Safari, it is useful to be able to isolate windows from each other in case one crashes. Learn how to use the Terminal window to launch multiple instances of the same app. Learn how to then use Automator to create an app that will do this for you automatically.

Video Transcript (Click to Expand)
Hi this is Gary with MacMost Now. On today's episode let's look at how to run multiple instances on an App on your Mac. In most cases you don't need to have multiple copies of an App running. For instance in TextEdit you can have several documents open in different windows. The same as in Pages and Numbers and other applications that have documents. In cases like Safari for instance you can have multiple windows open looking at multiple websites. You can even have multiple tabs open in those windows. So you never really need to have more than one copy of Safari or Browser running. One reason you may want to have an App running multiple times is if you are only allowed to open one window in it. For instance in the Calculator app. Another reason is if sometimes the app crashes. For instance since Safari is a web browser and can access all the sites in the internet and not all the sites in the internet are put together that well sometimes you run into one that will crash your browser particularly if it has a lot of media on it say some videos or games or something. You may notice that it crashes every once in a while when you go to that website. So you want to run a separate copy of Safari when you are viewing that website so that your other windows in Safari that are open won't crash with it. So say we wanted to run Calculator. You can run it in many different ways. But let's go to the Applications folder here and in the Applications folder we can double click on Calculator and it runs. Now we have this one calculator window. Sometimes it would be nice to have a second one. So how can we do that? Well an alternative way to launch an app is to use the Terminal window. So you launch Terminal. You can find that in your Applications folder as well. So let's quit Calculator here and let's instead run it using the Terminal. You do that using the Open command. So open, and then we have to give the full path to the application. So it will be /Applications/Calculator.app So I do that and it will actually run Calculator. The same thing as double clicking on it in the Finder. So let's quit the Calculator and go down here again. There is an alternative option for this command -n, which means run a new instance of. We can do the same thing here /Applications/Calculator.app and it will behave the same way. Now the difference is that if we switch back here to the Terminal window and we type that again, and the shortcut for doing that by the way is up arrow, will repeat the last command there on the line and then I can just do up arrow and return rather than typing all those characters, it will actually launch a second version of Calculator. I actually have two of them running. It shows me two in my Dock and I have two different calculators running and I can use them both separately. So that is kind of handy there, especially with the calculator app. You can do the same thing with Safari. That will launch Safari. Let's shrink this window down here, a nice little Safari window, and I can go to macmost in that window and I can go back here and retype the command or use the up arrow and return and it will launch a second copy of Safari, you can see here, and I can go to another website in this one. The cool thing is that even though this looks like two separate windows running Safari I actually have two different instance of Safari so if I quit one or say it crashes for some reason I can very easily then just still have this second copy running. Now if you would rather not do Terminal commands you can actually put this all together in Automator. I am going to run Automator here and it is a very simple Automator script. I am actually going to go here in Terminal and copy this command here where we open -n /Applications/Calculator.app, copy that, and in Automator I am going to create a new application and then I am going to add to this application here a shell script. I am just going to type shell here in the search and Run Shell Script and I'm going to drag and drop that on here and I'm going to paste in that command right there and now I am going to Save it. I can Save it anywhere I want. I am just going to Save it on the Desktop for now. So MultiCalc.app. I'm going to quit Automator. Now I've got here on my Desktop you can see this multicalc.app and I can put that in my Applications folder if I want. I can put it anywhere I want. Just double click it and it will run Calculator and if I double click it again it will run Calculator again. So I can use it very quickly without using the Terminal to create multiple copies of Calculator. So I hope you found this useful. Until next time this is Gary with MacMost Now.

11 Responses to “MacMost Now 819: Running Multiple Instances Of the Same App On Mac”

  1. Johan-Martijn says:

    Gary, you hit the nail again! So many programmes allow only a single window – especially 3D and architecture that half the time you’re opening and closing various files instead of allowing side-by-side designs. Not anymore! Your Terminal/Automator solution works like a charm! Thank you so much. And it’s good for (Apple) business as well; a second monitor now comes in really handy!

  2. Marcia says:

    For Safari I just type command N for a new Safari window. Seems easier. What is the difference?

    • If Safari crashes, all windows close. If you have two copies of Safari open, one to run that “tricky video site that always seem to crash” and one that has other windows, then only the tricky app window crashes, and the rest are unaffected.

    • Rich O says:

      Comm+N only opens a new window within Safari. When you do what Gary is talking about it creates a “Copy” or “Clone” of the Safari App. It would be similar to having Safari open on 2 diff computers. Let’s say that you do your important browsing in one, but in the other copy you decide to visit a questionable website. Well, if either window crashes, the other running “Instance” is unaffected. Whereas, if you did this with Comm+N and it crashed, all that you were doing in Safari would be lost.

      • Rich O says:

        You beat me to it Gary. I was in the middle of typing. lol.

  3. Constance Brennan says:

    Worked like a charm for Safari (thank you), but I couldn’t get it to work for iTunes where it would be very helpful when buying music & wanting to check my Music folder to make sure I don’t already own it.

    • I can understand why it won’t work with iTunes. With iTunes you would be trying to open the SAME document — your iTunes Library. You can see why you wouldn’t want to have two different running apps toying with the same iTunes library.

      • Johan-Martijn says:

        But I can also see why Constance came up with the question. In former days and versions you could tear off one or more playlists and see them in their own window while shopping around and comparing in the iTuners store. You can’t do that anymore, and that’s a real bummer.

  4. Joe Bee says:

    Gary, Very valuable podcast. I use the CLI and “open” but was unaware of “-n” and the powerful role it plays.
    Closely related issue: figuring out what’s running in Mountain Lion. Three common views confuse this:
    1) COMMAND/TAB lets you switch, but not see the window you’ll be going to; its the most exhaustive.
    2) Mission Control, (Control-UP) lets you see some but not all of the windows you can switch to.
    3) Application windows (Control-DOWN) offer another set.
    Offer a podcast?

  5. Jerry says:

    Gary – easy to get this running with apps like calculator, but I can seem to get it to run for Microsoft Outlook. Using this text “open -n /Applications/Microsoft Office 2011/Microsoft Outlook.app”
    Any help would be very appreciated!

    • It may not. Outlook may prevent you from doing that. In fact, I’d be surprised if it LET you. After all, an email client is a complex connection between your computer and the email server — having two such connections could lead to trouble, corruption, lost data, crashes, etc. Same with accessing a single “library” of data (iTunes, iPhoto, etc).

Comments Closed.