sunlei / zsh-ssh

Better host completion for ssh in Zsh.
MIT License
130 stars 29 forks source link

Plugin won't work if `zsh` is not shipped with `pcre` #23

Open akire0ne opened 7 months ago

akire0ne commented 7 months ago

Hi and thanks for your very nice zsh plugin.

I had issues insalling it on my 2021 Macbook Pro (M1 Max, Ventura 13.6.2)

After install, Auto complete failed with this error message

❯ ssh _parse_config_file:6: failed to load module `zsh/pcre': dlopen(/usr/lib/zsh/5.9/zsh/pcre.so, 0x0009): tried: '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file, not in dyld cache)
_parse_config_file:6: -pcre-match not available for regex
  ssh

Thanks to some google I was able to find a similar issue / fix: https://github.com/zthxxx/jovial/issues/12

Long story short: System installed zsh (/bin/zsh) does not include pcre

I was able to fix by using zsh from brew. You need to do the following commands

brew reinstall zsh 
brew reinstall pcre pcre2
sudo chsh -s `/opt/homebrew/bin/zsh` $USER
(launch new terminal and you should be good)
jk779 commented 5 days ago

Sorry to raise this from the dead but none of the workarounds are doing it for me :/. I#ve tried all possible combinations of pcre, pcre2, zsh, compiling from source with pcre flag etc.

thats what happens when im trying to use auto complete on ssh:

~
❯ command -v zsh
/usr/local/bin/zsh

~
❯ /usr/local/bin/zsh --version
zsh 5.9 (x86_64-apple-darwin23.6.0)

~
❯ which zsh
/usr/local/bin/zsh

~
❯ ls /usr/lib/zsh/5.9/zsh/
attr.so         complete.so     datetime.so     langinfo.so     net             regex.so        system.so       zftp.so         zpty.so
cap.so          complist.so     deltochar.so    mapfile.so      newuser.so      rlimits.so      termcap.so      zle.so          zselect.so
clone.so        computil.so     example.so      mathfunc.so     param           sched.so        terminfo.so     zleparameter.so zutil.so
compctl.so      curses.so       files.so        nearcolor.so    parameter.so    stat.so         watch.so        zprof.so

~
❯ ssh a_parse_config_file:7: failed to load module `zsh/pcre': dlopen(/usr/lib/zsh/5.9/zsh/pcre.so, 0x0009): tried: '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file, not in dyld cache)
_parse_config_file:7: -pcre-match not available for regex
  ssh a

(I tabbed after the ssh a)