1

how do I delete the "old" bash from Mac OS? I installed homebrew, installed bash 5.2 and set it up as the default. I disabled SIP and ran two commands and got these responses:

sudo rm /bin/bash

  • override r-xr-xr-x root/wheel restricted, compressed for /bin/bash? y
  • rm: /bin/bash: Read-only file system

sudo ln -s /usr/local/bin/bash bin/bash

  • ln: /bin/bash: File exists

According to the instructions I'm following,this should work. I'm trying to remove the installed, Apple-default 3.2 bash and redirect it to the recently installed /usr/local/bin/bash but even with SIP disabled I still get blocked

1
  • 1
    Can you explain why you want to do this? Is it causing you some problem?
    – terdon
    May 25, 2023 at 19:42

1 Answer 1

3

You can't remove the macOS version of bash as it is (in current versions of the OS) part of the read-only, protected system volume.

Perhaps more importantly, there is no need to do so. Install homebrew and then install bash. In that setup, installation of material is either on /usr/local, for an Intel architecture or /opt/homebrew for an Apple Silicon one.

Once installed, your PATH variable is adjusted to prepend the appropriate directory from which to first search. Thusly, a current version of bash can be sought before Apple's ancient default.

Documentation for homebrew is here.

1
  • There are reasons though, because any scripts that you specify with !#/bin/bash as the interpreter will run the old 3.2.57 version shipped with Mac OS, so you can't use newer features like associative arrays with scripts without manually changing the interpreter, which sucks from a portability point of view. I would love to relink /bin/bash to a more modern version instead.
    – Setomidor
    Mar 28 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .