Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
akire0ne opened this issue Jan 31, 2024 · 2 comments
Open

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

akire0ne opened this issue Jan 31, 2024 · 2 comments

Comments

@akire0ne
Copy link

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: zthxxx/jovial#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)
@akire0ne akire0ne changed the title Plugin won't work if zsh is not shipped to pcre Plugin won't work if zsh is not shipped with pcre Jan 31, 2024
@jk779
Copy link

jk779 commented Sep 12, 2024

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)

@1stvamp
Copy link

1stvamp commented Oct 29, 2024

Reinstalling zsh and pcre2 via brew still works but chsh in newer MacOS releases will no longer change user shells to "non-standard shells", you can instead use dscl:

sudo dscl . -create "/Users/${USER}" UserShell $(brew --prefix)/bin/zsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants