MATLAB Community

MATLAB, community & more

Starting MATLAB from the OS X Dock

Once again, I’d like to welcome guest blogger Ken Atwell. Ken is a product manager for MATLAB who spends much of his time focusing on platform support. His past blog posts about the release of Snow Leopard and Windows 7 generated quite a bit of interest and discussion, so Ken will be occasionally blogging about platform considerations when using MATLAB. This week, Ken writes about the relationship between MATLAB and the Mac OS X Dock.

The Dock is OS X’s mechanism for giving users access to frequently-used applications. There are two primary ways to get an application into the Dock. However, in the case of MATLAB, only one of these will work:

  1. The Working Way. Go to your Applications folder and drag the MATLAB application (it will be called “” or similar, depending on the version of MATLAB you have installed) to the Dock (Figure 1). The icon will be the familiar L-shaped membrane, but with an up-arrow overlay.
  2. The Not Working Way. Start MATLAB from Applications, and then add MATLAB to the Dock using click-and-hold->Options->Keep in the Dock. Unfortunately, starting MATLAB from a Dock icon created this way will results in a MATLAB crash at start-up. If you have created a Dock icon in this manner, remove it and recreate it using the “working” method above.

Figure 1: Dragging the MATLAB app from Applications to the Dock
 Dragging the MATLAB app from Applications to the Dock

What is going on?! The reason for this behavior lies in MATLAB’s somewhat complex start-up sequence. MATLAB is started through a starter application that is responsible for starting the “real” MATLAB. In the first case, the starter application is added to the Dock (which is why the icon includes an up-arrow). In the second case, the “real” MATLAB is added to the Dock, and starting the “real” MATLAB directly from the Dock (or the Finder, for that matter) results in a crash. We expect to correct this in a future version of MATLAB.

With the starter application in the Dock, MATLAB should start normally and you will get a second MATLAB icon (the running, “real” MATLAB) in the Dock (Figure 2). Again, we acknowledge this is could be improved; there should only be one icon.

Figure 2: The Dock containing both the “real” MATLAB and the starter application
 Dragging the MATLAB app from Applications to the Dock

Once MATLAB is running, you can use either of these icons to bring MATLAB into focus. Given this behavior, it may be unclear how you can start a second instance of MATLAB. You can do this from a Terminal window as follows (replacing “R2009b” with your version of MATLAB as required):

  1. Go to the Utilities folder inside your Application folder.
  2. Open Terminal.
  3. Type: /Applications/
  4. Press Return.
  5. Note that closing the terminal window will also close the second MATLAB.

Be aware that changing any application setting that is saved on disk, such as your Preferences, Desktop layout, and MATLAB path, will not take effect across other already-running instances of MATLAB, and the exact state that will be stored to disk can be difficult to predict. For this reason, I recommend against wholesale changes to your MATLAB environment when running multiple instances of MATLAB.

I hope this information will be helpful to Mac users who would like to launch MATLAB directly from the Dock. If you have any other Dock tricks you’d like to share with fellow MATLAB users, please chime in below!



To leave a comment, please click here to sign in to your MathWorks Account or create a new one.