Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I usually launch programs from Spotlight, and there is one program that I want to launch second process. The program in particular is Mathematica. The second process of Mathematica allows me to keep working on while the first process is tied up to evaluation of some expressions, which take a long time to compute. Furthermore, it is also beneficial that global variables are not shared between two notebooks.

I can launch the first process of Mathematica from Spotlight without a problem. However, when I select Mathematica in Spotlight for the second time, it does not launch the second process. Instead, it focuses on a window of the first Mathematica process. I know I can launch the second process from command line by invoking

/Applications/Mathematica.app/Contents/MacOS/Mathematica

However, I do not want to use command line if possible. I also observe similar behavior in a different program (Adobe Reader), so I guess this is how Spotlight behaves by default. Is there anything that I can do to let Spotlight launch another process of a program instead of focusing on an existing window? If so, how can I do that?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There is nothing you can do to achieve this. Applications are not usually meant to be launched multiple times. Some, like Safari 5, TextMate, or iTunes behave oddly or prevent this completely.

But you can wrap that command-line call of yours, or preferably the better supported way

open -n -a Mathematica

in an Automator script. This way, you can launch a program, or run a Service that launches the second Mathematica instance.


To do this, open Automator, select either Application or Service, double-click the Run Shell Script action in the Library on the left, and add your command-line call to it. I suggest you use mine, because it returns immediately after launching the program. If it's a service, select that it receives no input in any application.

Now save it. If it's an application, store it anywhere and drag it e.g. to the Dock, the Finder toolbar or Finder sidebar for quick access; if it's a service, it's in the Services sub-menu of the application menu. You can even assign a keyboard shortcut in System Preferences » Keyboard » Keyboard Shortcuts » Services.

share|improve this answer
    
Thank you for your answer. Your solution indeed solve my problem, and I am sure Automator will help me more along the way. Being a recent user of mac at work, it is good to know a new thing about mac. –  Seiji Kumagai Nov 15 '11 at 21:02
    
@Skum You're welcome. Automator can be used quite flexibly. It seems to me that I answer half of the OS X question on this site with a short intro to Automator. You can run shell scripts (therefore arbitrary command line programs), AppleScript (including GUI scripting), and a whole lot more, and as applications and services, these scripts are well integrated into and easily accessible from the OS X UI. –  Daniel Beck Nov 15 '11 at 21:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.