I run Mathematica on an iMac running OS X 10.6.8.
I have set the OS's "Launch Items" to include Mathematica so that the application opens when the computer boots.
Now I want to go further and set Mathematica to launch a specific notebook on startup.
Note: this note book has initialization cells so it will evaluate automatically. All of this goes to my ongoing automation of a variety of processes to run while I take a few days of vacation (IF I can get this working ;-)
I've searched Mathematica's "Preferences" and "Options", but haven't found anything to identify or set a specific notebook to launch when Mathematica starts.
If someone knows a way to do this that I haven't seen in these, please advise.
The following link to an old StackOverflow question, mathematica start front end and eval notebook from command line looks like it provides a way to do what I want to do, but on a Windows OS.
As I think about applying or translating this idea to my iMac, it seems like rather than having Mathematica as a "Launch Item", I have a couple of other possibilities:
- setup a shell script using something like OS X's launchD to launch Mathematica and a specific notebook OR
- use MathematicaScript to launch just the kernel and run the code currently in the desired notebook.
Neither of these are strong points. Can anyone recommend a way to do this or on Mac OS X 10.6.8 or some specific references that would help me learn what I need to do?
A bit of a footnote for some additional context. The notebook I need to run launches parallel kernels on a couple of servers. I've chosen this path of getting all of this to run on the machines' startup rather than putting all of this on a timer or even logging on remotely to run them because, I've found that (at least for now) restarting both Mathematica on the client machine and as parallel kernels on the servers just runs more reliably. It particularly avoids problems with kernels that haven't launched or some of which have shut down.
The Mac OS has a very reliable method to launch and shutdown the machines at specific times. As I need the code in the notebook to run at specific times this seems like a good thing on which to layer the other functionality.