5

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?

1 Answer 1

3

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.

2
  • 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. Nov 15, 2011 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, 2011 at 21:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .