Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to update my Bash in Mac by MacPorts

I updated unsuccessfully my Bash to 3.2.48 by MacPorts.

It seems that I do not have it active, since I get

echo $BASH_VERSION 3.2.17(1)-release 

How can you make the newest Bash active such that I get it for my login shell?

like image 943
Léo Léopold Hertz 준영 Avatar asked Apr 26 '09 17:04

Léo Léopold Hertz 준영


People also ask

How do I update bash on Mac?

Change The Default Bash on Mac First, you will need to update the list of permitted shells by adding the bash brew version into /private/etc/shells . You can do this by editing directly the file or using the tee -a command as shown below. Finally, you will need to update your user's shell with the chpass command line.

Why does Mac use old bash?

To put that in perspective, the version of Bash used on your Mac was new when the first iPhone was introduced. Apple is likely using the older version because the licensing for the Bash shell changed from GNU GPL 2 (General Public License) to GNU GPLv3, which includes restrictions that could cause problems for Apple.

Is bash preinstalled on Mac?

Default Bash Version on macOSThis version of Bash is included in all versions of macOS, even the newest one. The reason that Apple includes such an old version of Bash in its operating system has to do with licensing.


1 Answers

Run the following code, for instance to change your shell to the newest Bash installed by MacPorts

chsh -s /opt/local/bin/bash 

If that gives you the message,

"non-standard shell"

you will need to add

/opt/local/bin/bash 

to

/etc/shells 

Note that /etc/shells is just a text file, so you can edit it directly if you authenticate as root. You can programmatically change it by the command

sudo -s Password: # echo /opt/local/bin/bash >> /etc/shells 

If your first chsh command failed, run it now again if you managed to change the above file.

like image 141
Nicholas Riley Avatar answered Sep 17 '22 21:09

Nicholas Riley