![]() Since you want to use the newly installed Bash shell as the default shell, it must be able to act as a login shell. These shells are listed in the /etc/shells file. the shell used after logging in to the system) to a list of “trusted” shells. UNIX includes a security feature that restricts the shells that can be used as login shells (i.e. Now you have make this version the default. Since the directory of the new version ( /usr/local/bin) comes by default before the directory of the old version ( /bin) in the PATH variable, the version used when you just type bash is the new one: $ bash -version GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0). $ /bin/bash -version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) Copyright (C) 2007 Free Software Foundation, Inc. There is NO WARRANTY, to the extent permitted by law. License GPLv3+: GNU GPL version 3 or later This is free software you are free to change and redistribute it. The first one is the new version, and the second one is the old version: $ /usr/local/bin/bash -version GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0) Copyright (C) 2019 Free Software Foundation, Inc. To verify the installation, you can check that you now have two versions of Bash on your system: $ which -a bash /usr/local/bin/bash /bin/bash I recommend to use Homebrew to install the latest version of Bash: brew install bash The two versions will exist side by side on your system, but you can just ignore the old version from there on. Note: the following instructions don’t change the old version of Bash, but rather install a new version and set it as the default. To upgrade the default shell of your macOS system to the latest version of Bash, you have to do three things:Įach step is extremely easy, as explained in the following. I wrote an entire article called Programmable Completion for Bash on macOS, which explains all you need to know to take full advantage of programmable completion on macOS after upgrading to a newer Bash version. This means that these completion scripts don’t work on Bash 3.2, which means that you miss out from the completion functionalities of many commands, if you keep using the default macOS shell.īy upgrading to a newer version of Bash, you become able to use these completion scripts, which can be extremely useful. The problem is that the programmable completion features of Bash have been extended since version 3.2, and most completion scripts use these new features. These completion scripts have to be sourced in your shell to enable the completion functionality for a command. Programmable completion logic is defined (by the creators of commands) in completion specifications, typically in the form of completion scripts. Programmable completion allows to do that. Or typing cmd host rm and then seeing a list of all the “hosts” that are specified in some configuration file. Imagine, for example, typing cmd -, and then seeing a list of all options that are applicable to this command. However, programmable completion goes much beyond that, because it allows command-specific completions that can depend on the context. You probably use auto-completion for completing commands, filenames, and variables by starting to type and then hitting Tab to auto-complete the current word (or hitting Tab two times to get a list of all possible completions, if there is more than one). This is a feature that allows command-specific auto-completions in Bash. Why Upgrading?īut why even bother with getting a newer version if Bash 3.2 works fine? The main reason, for me personally, is programmable completion. In this article, I give instructions to upgrade the default shell of your system to the newest version of Bash. At the time of this writing, the newest version of GNU Bash is 5.0 (see here), which has been released in January 2019. Linux) proceeds with new versions of Bash, whereas macOS users are stuck with an old version from a decade ago. Version 3.2 of GNU Bash is the last version with GPLv2, which Apple accepts, and so it sticks with it. You can find some discussions about this here and here. ![]() Since version 4.0 (successor of 3.2), Bash uses the GNU General Public License v3 (GPLv3), which Apple does not (want to) support. The reason that Apple includes such an old version of Bash in its operating system has to do with licensing. ![]() To see how outdated the Bash version included in macOS is, execute the following command: $ bash -version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) Copyright (C) 2007 Free Software Foundation, Inc.Īs you can see, this is GNU Bash version 3.2, which dates from 2007! This version of Bash is included in all versions of macOS, even the newest one. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |