{"id":744,"date":"2019-10-18T12:48:39","date_gmt":"2019-10-18T17:48:39","guid":{"rendered":"http:\/\/www.brunerd.com\/blog\/?p=744"},"modified":"2019-10-27T01:53:11","modified_gmt":"2019-10-27T06:53:11","slug":"macos-shell-games","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2019\/10\/18\/macos-shell-games\/","title":{"rendered":"macOS shell games: long live bash"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">TL;DR \u2013&nbsp;Bash ain&#8217;t goin&#8217; nowhere on Mac, both version-wise and in terms of its presence. Looking at the longevity of other shells on the system, it will likely be around for a good while longer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There&#8217;s been a lot of hand wringing and angst online about bash and zsh becoming the new default shell. Some folks feel Apple is signaling deprecation and removal and have the crushing feeling they must convert all their bash script to zsh. I think that&#8217;s a bit unnecessary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">True, the default shell is changing from bash to zsh, as Apple notes <a href=\"https:\/\/support.apple.com\/en-us\/HT208050\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">here<\/a>. This is indeed a Good Thing\u2122 as zsh shell has been one of the most frequently updated shells on macOS. Bash, on the other hand, has been stuck at varying versions of 3.2 for 12 years now! On the plus side, sysadmins have &#8220;enjoyed&#8221; predictable and stable behavior from bash during this time. Sure, you&#8217;d love new features but when you are scripting for the enterprise, across multiple OS versions, this is just the sort of thing you want: boringness and dependability.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As far as deprecations go, the <em>only<\/em> thing <a href=\"https:\/\/developer.apple.com\/documentation\/macos_release_notes\/macos_catalina_10_15_release_notes#3318248\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Apple has signaled<\/a> as being deprecated <em>eventually<\/em> are scripting language runtimes (not shells):<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won\u2019t include scripting language runtimes by default, and might require you to install additional packages. If your software depends on scripting languages, it\u2019s recommended that you bundle the runtime within the app. (49764202)<br><\/p><p>Use of Python 2.7 isn\u2019t recommended as this version is included in macOS for compatibility with legacy software. Future versions of macOS won\u2019t include Python 2.7. Instead, it\u2019s recommended that you run&nbsp;<code>python3<\/code>&nbsp;from within Terminal. (51097165)<\/p><cite><a href=\"https:\/\/developer.apple.com\/documentation\/macos_release_notes\/macos_catalina_10_15_release_notes#3318248\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">mac OS Catalina 10.15 Release Notes<\/a><\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve done some digging and culled the shell versions from OS X 10.0 to macOS 10.15, along with their respective release dates. I think it shows that shells, no matter how old and crusty, tend to be long lived and not soon removed on macOS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s a quick way to check your shell versions (<a href=\"https:\/\/unix.stackexchange.com\/questions\/416760\/how-to-find-out-the-version-number-of-dash-without-resorting-to-package-manage\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">except for dash<\/a>): <\/p>\n\n\n<p><script src=\"https:\/\/gist.github.com\/brunerd\/bdffaeb2024d9b6190330aaadebbba6e.js\"><\/p>\n<p><\/script><\/p>\n\n\n<table  class=\"wp-block-table table table-hover\" ><tbody><tr><td><strong>macOS<\/strong><\/td><td><strong><a href=\"http:\/\/zsh.sourceforge.net\/News\/\">zsh<\/a><\/strong><\/td><td><strong><a href=\"https:\/\/ftp.gnu.org\/gnu\/bash\/?C=M;O=A\">bash\/sh<\/a><\/strong><\/td><td><strong>csh\/tcsh<\/strong><\/td><td><strong>ksh<\/strong><\/td><td><strong>dash<\/strong><\/td><\/tr><tr><td>1<strong>0.0<\/strong><\/td><td>3.0.8 (2000-05-16)<\/td><td>3.0.8 (zsh, no bash)<\/td><td>6.08.00 (1998-10-02)<\/td><td>&#8211;<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.1<\/strong><\/td><td>3.0.8 (2000-05-16)<\/td><td>3.0.8 (zsh, no bash)<\/td><td>6.10.00 (2000-11-19)<\/td><td>&#8211;<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.2<\/strong><\/td><td>4.0.4 (2001-10-26)<\/td><td>2.05b.0 (2002-07-17)<\/td><td>6.10.00 (2000-11-19)<\/td><td>&#8211;<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.3<\/strong><\/td><td>4.1.1 (2003-06-19)<\/td><td>2.05b.0 (2002-07-17)<\/td><td>6.12.00 (2002-07-23)<\/td><td>&#8211;<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.4<\/strong><\/td><td>4.2.3 (2005-03-00)<\/td><td>2.05b.0 (2002-07-17)<\/td><td>6.12.00 (2002-07-23)<\/td><td>M p (1993-12-28)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.5<\/strong><\/td><td>4.3.4 (2007-04-19)<\/td><td>3.2.17 (2007-05-01)<\/td><td>6.14.00 (2005-03-23)<\/td><td>M s+ (1993-12-28)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.6<\/strong><\/td><td>4.3.4 (2008-11-03)<\/td><td>3.2.48 (2008-11-18)<\/td><td>6.15.00 (2007-03-03)<\/td><td>M s+ (1993-12-28)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.7<\/strong><\/td><td>4.3.11 (2010-12-20)<\/td><td>3.2.48 (2008-11-18)<\/td><td>6.17.00 (2009-07-10)<\/td><td>M s+ (1993-12-28)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.8<\/strong><\/td><td>4.3.11 (2010-12-20)<\/td><td>3.2.48 (2008-11-18)<\/td><td>6.17.00 (2009-07-10)<\/td><td>JM 93u (2011-02-08)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.9<\/strong><\/td><td>5.0.2 (2012-12-12)<\/td><td>3.2.51 (2010-03-17)<\/td><td>6.17.00 (2009-07-10)<\/td><td>JM 93u (2011-02-08)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.10<\/strong><\/td><td>5.0.5 (2014-01-06)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.17.00 (2009-07-10)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.11<\/strong><\/td><td>5.0.8 (2015-05-31)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.18.01 (2012-02-14)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.12<\/strong><\/td><td>5.2 (2015-12-02)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.18.01 (2012-02-14)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.13<\/strong><\/td><td>5.3 (2016-12-12)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.18.01 (2012-02-14)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.14<\/strong><\/td><td>5.3 (2016-12-12)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.18.01 (2012-02-14)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>&#8211;<\/td><\/tr><tr><td><strong>10.15<\/strong><\/td><td>5.7.1 (2019-02-03)<\/td><td>3.2.57 (2014-11-07)<\/td><td>6.21.00 (2019-05-08)<\/td><td>AJM 93u+ (2012-08-01)<\/td><td>dash-9 (1993)<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, zsh has has been updated with almost every new release of macOS. Bash really hit a wall with 3.2 and as many have noted, it was v4&#8217;s change in licensing to GPLv3 that caused this (sh is really bash in sh compatibility mode so the versions are intertwined). csh\/tcsh has the same duality thing going on and took a notably giant 7 year leap in 10.15 to a version from 2019. ksh has remained at the same version just as long as bash yet I don&#8217;t think anyone is fretting that ksh will be deprecated or removed. Finally, dash is just a weirdo that apparently <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi?bug=764172\" target=\"_blank\">disdains versioning<\/a>! I used a combination of <code>what \/bin\/dash<\/code> and <code>man dash<\/code> to get some sort of crude answer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So there you go: In my opinion, all signs point to bash being yet another shell on macOS for some time. Removing bash from macOS would break a lot of stuff and while that reason alone hasn&#8217;t stopped Apple before, I think they will let sleeping dogs lie. Go ahead and <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/scriptingosx.com\/zsh\/\" target=\"_blank\">learn zsh<\/a>, <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/rothgar\/mastering-zsh\" target=\"_blank\">master it<\/a>, <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/robbyrussell\/oh-my-zsh\" target=\"_blank\">customize it<\/a>, or <a href=\"https:\/\/terminalsare.sexy\/#zsh\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">make it &#8220;sexy&#8221;<\/a> but take the rumors of its demise on macOS with a grain of salt and dose of skepticism.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR \u2013&nbsp;Bash ain&#8217;t goin&#8217; nowhere on Mac, both version-wise and in terms of its presence. Looking at the longevity of other shells on the system, it will likely be around for a good while longer. There&#8217;s been a lot of hand wringing and angst online about bash and zsh becoming the new default shell. Some [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,19,4,12],"tags":[20,25,24,23],"class_list":["post-744","post","type-post","status-publish","format-standard","hentry","category-apple","category-bash","category-os-x","category-scripting","tag-bash","tag-macos","tag-shell","tag-zsh"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=744"}],"version-history":[{"count":14,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/744\/revisions"}],"predecessor-version":[{"id":766,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/744\/revisions\/766"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}