Traap / nvims

Safely experiment with multiple Neovim configurations.
BSD 3-Clause "New" or "Revised" License
52 stars 10 forks source link

Fix for empty list on Mac OSX #8

Closed haqthat closed 6 months ago

haqthat commented 7 months ago

I came across this project from a Youtube video, and was excited to try it. Unfortunately running it on my Mac "works" but I end up with an empty list when you go to choose a distro.

I looked into it, and there are a couple things needed that make it work for Mac, maybe the script could be updated to accommodate us.

By default new versions of OSX use the zsh shell, and porting this app over to handle both zsh and bash would be a little painful, I tried.

The only real issue is the version of bash that is on OSX these days is quite old since the default is changed to zsh.

It's quite easy to fix though. If you have brew installed, you can just

brew install bash

Which will upgrade/add an alternate bash from a 3.x version to a 5.x version.

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin23

brew install bash

/usr/local/bin/bash --version
GNU bash, version 5.2.26(1)-release (x86_64-apple-darwin23.2.0)

Then the only thing that needs changed is the shebang in the script "nvims".

from #!/bin/bash to #!/usr/local/bin/env bash

The system default bash won't be changed, but we have a newer version in /usr/local/bin/bash that is newer and can handle the way the array handling is setup in nvims.

You could make a check to see if bash is old, and warn them that the might need to upgrade, or just provide additional requirements in the readme for Mac users.

TLDR:

brew install bash
echo /usr/local/bin/bash | sudo tee -a /etc/shells
sed -i '1 s/^.*$/\#\!\/usr\/local\/bin\/env bash/' /usr/local/bin/nvims

You'll need sudo to edit nvims with sed.

Should fix issue #3 and #6

Traap commented 7 months ago

@haqthat Thank you for the tips and detailed notes. I added an OSX section to the README and linked it to this topic.

Traap commented 6 months ago

Linked this topic to README.