{"id":363,"date":"2010-02-08T13:36:10","date_gmt":"2010-02-08T13:36:10","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2010\/02\/08\/starting-matlab-from-the-os-x-dock\/"},"modified":"2010-02-08T13:36:10","modified_gmt":"2010-02-08T13:36:10","slug":"starting-matlab-from-the-os-x-dock","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2010\/02\/08\/starting-matlab-from-the-os-x-dock\/","title":{"rendered":"Starting MATLAB from the OS X Dock"},"content":{"rendered":"<p><em>Once again, I\u2019d 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 <a href=\"https:\/\/blogs.mathworks.com\/community\/2009\/08\/31\/pouncing-on-snow-leopard\/\">Snow Leopard<\/a> and <a href=\"https:\/\/blogs.mathworks.com\/community\/2009\/10\/19\/is-7-your-lucky-number\/\">Windows 7<\/a> 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.<\/em><\/p>\n<p>The Dock is OS X\u2019s 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:<\/p>\n<ol>\n<li> <strong>The Working Way<\/strong>.  Go to your <strong>Applications <\/strong>folder and drag the MATLAB application (it will be called \u201cMATLAB_R2009b.app\u201d 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.<\/li>\n<li> <strong>The Not Working Way<\/strong>.  Start MATLAB from <strong>Applications<\/strong>, 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 \u201cworking\u201d method above.<\/li>\n<\/ol>\n<p><div align=\"center\">\n<strong>Figure 1: Dragging the MATLAB app from Applications to the Dock<\/strong><br \/>\n<a  href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_atwell_starting_matlab_from_the_os_x_doc\/dragging_matlab.png\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_atwell_starting_matlab_from_the_os_x_doc\/dragging_matlab_small.png\" alt=\" Dragging the MATLAB app from Applications to the Dock\"><\/a>\n<\/div>\n<\/p>\n<p>What is going on?!  The reason for this behavior lies in MATLAB\u2019s somewhat complex start-up sequence.  MATLAB is started through a starter application that is responsible for starting the \u201creal\u201d 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 \u201creal\u201d MATLAB is added to the Dock, and starting the \u201creal\u201d 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.  <\/p>\n<p>With the starter application in the Dock, MATLAB should start normally and you will get a second MATLAB icon (the running, \u201creal\u201d MATLAB) in the Dock (Figure 2).  Again, we acknowledge this is could be improved; there should only be one icon.<\/p>\n<p><div align=\"center\">\n<strong>Figure 2: The Dock containing both the \u201creal\u201d MATLAB and the starter application<\/strong><br \/>\n<a  href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_atwell_starting_matlab_from_the_os_x_doc\/starter_and_real_on_dock.png\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/ken_atwell_starting_matlab_from_the_os_x_doc\/starter_and_real_on_dock_small.png\" alt=\" Dragging the MATLAB app from Applications to the Dock\"><\/a>\n<\/div>\n<\/p>\n<p>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 \u201cR2009b\u201d with your version of MATLAB as required):<\/p>\n<ol>\n<li>Go to the Utilities folder inside your Application folder.<\/li>\n<li>Open Terminal.<\/li>\n<li>Type: <tt>\/Applications\/MATLAB_R2009b.app\/bin\/matlab<\/tt><\/li>\n<li>Press Return.<\/li>\n<p>Note that closing the terminal window will also close the second MATLAB.\n<\/ol>\n<p>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.<\/p>\n<p>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\u2019d like to share with fellow MATLAB users, please chime in below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once again, I\u2019d 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&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2010\/02\/08\/starting-matlab-from-the-os-x-dock\/\">read more >><\/a><\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/363"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}