chris-marsh / pureline

A Pure Bash Powerline PS1 Command Prompt
MIT License
501 stars 94 forks source link

Pretty broken in OSX #62

Open darkvertex opened 3 years ago

darkvertex commented 3 years ago

I use Pureline on Linux and WSL shells all the time but I recently tried to deploy it on an OSX box I ssh to sometimes and it's completely broken. :(

If it helps, my default shell is Bash (version 3.2.57), running on Darwin 20.3.0 (aka Big Sur), using the latest "main" branch:

alan@hitchcock:~$  source $HOME/repos/pureline/pureline
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
\e]2;'\u@\h: \w' alan@hitchcock ↔ ~ ↔

I guess it's probably because the Bash bundled with OSX is very old, maybe:

alan@hitchcock:~$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
Copyright (C) 2007 Free Software Foundation, Inc.

(My WSL Ubuntu environment where Pureline works perfectly has Bash 4.2 copyright 2011, for comparison.)

chris-marsh commented 3 years ago

Yes, PureLine needs Bash v4 minimum bescause it uses associative arrays. The issue was first mentionein in Issue 7. I don't have access to OSX, but from what I read, bash can be upgraded using Homebrew. I know its not a perfect solution.

It does niggle me that PureLine does not work without effort on OSX, but since bash is now at v5.1+ I'm somewhat reluctant to put time into compatibilty with v3.2. Especially when v4 has been out for 12 years being released in 2009.

darkvertex commented 3 years ago

I hear ya. I too was surprised that OSX's bundled Bash is from 2007. You'd think they'd refresh it a little. 🤷‍♂️

You can close this issue if you want. I understand it's a bit of an undertaking to support such an old version of Bash.

Could you at the very least add a line in the INSTALL section of your main README to mention "Bash version 4+ is required."? I think it'll help prevent further "it's broken!" tickets like mine.

ls-1N commented 1 year ago

Part of the reason why bash is so old on macOS might be because they are trying to force a migration to zsh.