Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: multiple instances of Stata in OSX


From   [email protected]
To   [email protected]
Subject   Re: st: multiple instances of Stata in OSX
Date   Fri, 10 Oct 2003 10:33:46 -0500

> I have recently switched to a Mac laptop using  OS-X.  One thing I  
> seem unable to do, which I can do in Windows, is run multiple  
> instances of Stata at the same time.  I'm quite addicted to such  
> behavior since I can have different data sets open at the same time.  

Macs always bring an application to the front if it's already running and
double-clicked from the Finder.  There's no way to prevent this.

In the Mac OS 8/9 days, you would simply just have extra copies of the Stata
application (with different filenames) if you wanted to run multiple
instances.  You can obviously do the same thing in Mac OS X but as someone
else mentioned, you can also launch multiple instances from a terminal.

Another way (and takes up less space) is to create a shell script that
contains the line:

/Applications/Stata/StataSE &

and is named somefilename.command (the .command extension is important).
Make sure the script is executable by entering from a terminal:

chmod +x somefilename.command

However, this opens the Terminal application which executes the script and
leaves behind an open Terminal window.  There may be another similar method to
doing this that is a little more elegant but this is off the top of my head.

> Open terminal and type:
>  ./'/Applications/Stata/Stata.bin' &

If your Stata application has a Stata.bin file extension, something went wrong
with a previous -update swap-.  Rename the file to Stata and make sure you
have the latest update.  You can also manually update from the website which
will ensure you have the latest update.

Beginning with the next update, Stata for the Macintosh is moving to Mac OS
X's preferred application format which is an Application Package.  This
application format will supposedly allow Stata to launch and execute faster.

I didn't notice any difference in launch or execution speed when I launched
the new Stata from the Finder but I did notice a significant difference when
launched from a terminal.  With the old executable format, Stata
launched from a terminal would perform at less than half speed (this includes
running in batch mode).  Stata would still perform at full speed if launched
from the Finder though.  The new application format fixes this problem.

However, the actual path to the Stata executable will change with this new
application format.  Even though you'll still see what appears to be the
Stata executable in /Applications/Stata from the Finder, the true path to
the executable buried in the package will be (if running Stata/SE):

/Applications/Stata/StataSE.app/Contents/MacOS/StataSE

Whatever scripts or aliases you use that point to /Applications/Stata/StataSE
will have to be modified after the next update.

> ...but I'd have imagined that the clever folks at Stata would have 
> included some GUI way to do this.  Is this the only way to run multiple 

There is a way to do it from Stata.  Create a profile.do in your personal
ado directory and add the lines:

window menu append item "stUser" "Launch Stata/SE" "winexec /Applications/Stata/StataSE"
window menu refresh

Whenever the next executable update comes out, you'll need to change the first
line to:

window menu append item "stUser" "Launch Stata/SE" "winexec /Applications/Stata/StataSE.app/Contents/MacOS/StataSE"

Anyway, you can now select "Launch Stata/SE" from the User menu and it will
launch another instance of Stata/SE.

> instances in OSX?  As far as I can tell, the issue isn't discussed in 
> the documentation.

One problem with running multiple instances is that Mac OS X does not allow us
to change the application name programmatically.  For example, if you wanted a
second instance of Stata/SE to show up as "Stata/SE 8.1 [2]" from the menubar
and/or Dock, this is not possible once the application has started.  The
application name is hardcoded in a file and can only be manually changed.  So
you can't tell each instance of Stata apart.  Add the fact that windows from
different applications can overlap and things can get downright confusing (how
do you know if the command window you're typing in is related to the Results
window you're looking at?) There is a way to tell Stata that when it is
brought to the foreground, bring all of its windows to the foreground (look in
the General Preferences) but there can still be confusion of which window
belongs to which Stata.  There is a strong potential for disaster because you
can do something destructive in the wrong window!

With Windows, you can easily change the application name and most of the
windows are contained within a parent window so discerning between different
Statas is not too difficult.

We don't discourage anyone to try running multiple instances of Stata on Mac
OS X, but until Apple makes it easier to handle the running of multiple
instances, we're not going to encourage anyone to try it either.

-Chinh Nguyen
 [email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index