How can I use Mac Ports Bash instead of Apple’s Bash?
1
vote
2
answers
278
views
I've installed Mac Ports and its bash version on 10.15 Catalina, but when I open the terminal, I am still greeted with Apples old bash version and I am missing all the Mac ports that I have installed. They are there, but only in the new bash version.
(1) In Apple’s System Preferences, in the Advanced section of Users & Groups, I have inserted the Mac Ports bash path
/opt/local/bin/bash
, but it doesn't have any effect.
(2) Changing the Terminal preferences to /opt/local/bin/bash
(see suggestion below from Tim Kennedy) also had no effect.
This is the situation after applying these two changes:
$ echo $BASH_VERSION
5.2.32(1)-release
$ bash -version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
$ which bash
/bin/bash
There is also a related post «again… bash version mac didn't change », but it covers the Homebrew version and not Mac Ports and it doesn't solve this problem, either. It does contain however some other useful information.
(3) Applyig the solution of above mentioned article also had no effect:
$ chsh -s /opt/local/bin/bash
Changing shell for admin.
Password for admin:
chsh: /opt/local/bin/bash: non-standard shell
$ which bash
/bin/bash
(4) The suggestion to edit the /etc/shells
file also had no effect.
Finally, Marc Wilson’s suggestion about the $PATH (see below) led me to the solution. My /etc/paths
initially looked like this:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
When I placed the Mac Ports directory /opt/local/bin
before Apple’s bash location /bin
, using sudo vi /etc/paths
, I finally succeeded. Now, when open the Terminal, I get:
$ echo $BASH_VERSION
5.2.32(1)-release
$ bash -version
GNU bash, version 5.2.32(1)-release (x86_64-apple-darwin19.6.0)
$ which bash
/opt/local/bin/bash
$ figlet it works
_ _ _
(_) |_ __ _____ _ __| | _____
| | __| \ \ /\ / / _ \| '__| |/ / __|
| | |_ \ V V / (_) | | | <\__ \
|_|\__| \_/\_/ \___/|_| |_|\_\___/
Thanks to all!
Asked by Gary U.U. Unixuser
(339 rep)
Dec 3, 2024, 12:52 PM
Last activity: Dec 6, 2024, 09:13 PM
Last activity: Dec 6, 2024, 09:13 PM