Bash on Mac: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= * Mac") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Mac#Subjects|Mac]] | * [[Mac#Subjects|Mac]] | ||
=bash Version on Mac= | |||
A specific bash executable is picked like any other executable, by scanning the PATH and using the first match. To force a specific bash version, ensure the directory it exists in comes first in PATH. | |||
For example, a brew-installed bash (5.0.17) is picked from <code>/usr/local/bin</code> because <code>/usr/local/bin</code> precedes <code>/bin</code> in PATH. | |||
The original Mac bash binary is available in <code>/bin/bash</code>, even if brew installs a newer version. | |||
To force the native bash to be used, ensure <code>/bin</code> precedes <code>/usr/local/bin</code> in PATH. | |||
=bash Installation= | |||
<syntaxhighlight lang='bash'> | |||
brew install bash | |||
</syntaxhighlight> | |||
=Set up bash as Default Shell= | |||
System Preferences → Users & Groups → Unlock → Select Current User → Control + Right Click → Advanced Options → Login shell → <code>/bin/bash</code> (or <code>/usr/local/bin/bash</code> if the latest Bash was installed with brew) | |||
=Get Rid of Default Interactive Shell is Now zsh= | |||
In .bash_profile: | |||
<syntaxhighlight lang='bash'> | |||
export BASH_SILENCE_DEPRECATION_WARNING=1 | |||
</syntaxhighlight> |
Latest revision as of 00:14, 4 December 2021
Internal
bash Version on Mac
A specific bash executable is picked like any other executable, by scanning the PATH and using the first match. To force a specific bash version, ensure the directory it exists in comes first in PATH.
For example, a brew-installed bash (5.0.17) is picked from /usr/local/bin
because /usr/local/bin
precedes /bin
in PATH.
The original Mac bash binary is available in /bin/bash
, even if brew installs a newer version.
To force the native bash to be used, ensure /bin
precedes /usr/local/bin
in PATH.
bash Installation
brew install bash
Set up bash as Default Shell
System Preferences → Users & Groups → Unlock → Select Current User → Control + Right Click → Advanced Options → Login shell → /bin/bash
(or /usr/local/bin/bash
if the latest Bash was installed with brew)
Get Rid of Default Interactive Shell is Now zsh
In .bash_profile:
export BASH_SILENCE_DEPRECATION_WARNING=1