0

I run the command source ~/.bash_profile and get the following error:

$ source ~/.bash_profile 
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: syntax error near unexpected token `<'
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: `           done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")'

The login shell that I use is bin/sh:

enter image description here

Whats the issue here and how to solve it?

Arefe
  • 11,321
  • 18
  • 114
  • 168

1 Answers1

1

This is how I solved the issue with the provided steps:

Install Homebrew from the docs on their homepage Install Git using Homebrew (optional, but nice to have a more up-to-date git)

brew install git

Now install bash:

brew install bash

Add this install of bash to the allowed shells list:

echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;

Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash Finally, change your shell to use this new one:

chsh -s /usr/local/bin/bash

Open a new terminal window/tab, and run these commands to double-check your work:

$ echo $SHELL
/usr/local/bin/bash
$ echo $BASH_VERSION
5.1.8(1)-release

This also solved the issue for running the source ~/.bash_profile whenever I open a new window in the terminal.

Reference:

The answer is from here How do I install Bash >= 3.2.25 on Mac OS X 10.5.8? by user jeffbyrnes

Arefe
  • 11,321
  • 18
  • 114
  • 168