dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

Errors on Bash-start

Open mortensassi opened this issue 8 years ago • 10 comments

Everytime i start my iTerm i get this messages at the beginning:

-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]

What does it mean and how do i solve this problem?

mortensassi avatar Mar 07 '16 12:03 mortensassi

You are running Bash 3. Set iTerm to use Bash 4 (however you get it).

Tatsh avatar Mar 07 '16 13:03 Tatsh

Where is this declare used? I could do a PR to give a clear error message in case Bash 3 is used, but I couldn't find it anywhere in these dotfiles.

dserodio avatar Mar 07 '16 19:03 dserodio

It's not used in the scripts here. The completion scripts that get referenced (after full installation) use declare -A.

See #544

Tatsh avatar Mar 08 '16 00:03 Tatsh

I downloaded the dotfiles, startet the bootstrap.sh and the brew.sh - after all the changes on the appearance the error message came. Now autocompletion with Tab does not work. If i change to bash 4.x the errors are gone, but my 'drush cc all' doesn't work anymore so i need to switch back to 3.x

mortensassi avatar Mar 08 '16 08:03 mortensassi

Drush is 99% of a PHP application. The only shell part is where it invokes PHP after finding the correct path. I have had Drush working on Bash 4.x for years, all versions. I'm sure your issue is solvable without going back to Bash 3.

Tatsh avatar Mar 08 '16 08:03 Tatsh

This is strange: now everything is working alright with the 4.x version of bash - gonna track this and come back if there is something new. But thanks to y'all

mortensassi avatar Mar 08 '16 11:03 mortensassi

I'm having the same issue on a fresh El Captain install. I installed the brew stuff before and added the proposed .path and ran bootstrap.sh later

lucasff avatar Mar 16 '16 22:03 lucasff

What do you get when you enter: echo $BASH_VERSION You need to switch to bash 4, like Tatsh suggested before. If you run the brew.sh you automatically install it so what you got to do is let chsh know that there is also a brew-version of bash with following command:

chsh -s /usr/local/bin/bash

this path usually is the path where the bash v4 is. After you did this you maybe need to configure your terminal-app to use this bash-version and you should be all good :)

mortensassi avatar Mar 16 '16 22:03 mortensassi

After a little bit searching I find the chsh -s /usr/local/bin/bash and adding the shell to /etc/shells did the trick. Thanks!

lucasff avatar Mar 16 '16 23:03 lucasff

@lucasff's solution works, but it needs to be updated for Apple Silicon:

$ chsh -s /opt/homebrew/bin/bash

Homebrew installs packages in a different location now (/opt/homebrew).

PaulRBerg avatar Nov 23 '21 14:11 PaulRBerg