b0o / tmux-autoreload

🧐 Automatically reload your tmux config file on change
MIT License
82 stars 6 forks source link

Doesn't work on Mac #3

Open matthewtusker opened 1 year ago

matthewtusker commented 1 year ago

My work Mac doesn't like this plugin:

❯ ~/.tmux/plugins/tmux-autoreload/tmux-autoreload.tmux -s
/Users/person/.tmux/plugins/tmux-autoreload/tmux-autoreload.tmux: line 22: declare: -g: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

It seems that -g for declare isn't available on Mac, as it uses Bash 3.2 (and -g is only available at some point in version 4. It's possible to use a newer version through Brew, but also requires playing around with files in /etc and this is a work machine that I really don't want to get to custom with.

Is there a way to modify this plugin to work with Bash 3.2? I'm guessing that some other lines won't work on such an old version of Bash...

EDIT: I've managed to get the plugin working but I've had to change the first line to #!/opt/homebrew/bin/bash and remove the -e argument from realpath. I don't suppose it's worth your time to make any changes, but I may not be the only Mac user that might want this plugin to work. If I have some time I'll have another look at this, and I'll create a PR if I'm successful.

elbouillon commented 1 year ago

fix works fine, thanks!

Ahg4goo9 commented 1 month ago

I want to add here that because of the declare -g it also requires bash 4+. MacOS is coming with a 3.2, so that is also something that should maybe be noted somewhere :-).