Sample Header Ad - 728x90

Unable to use zparseopts

0 votes
1 answer
71 views
I'm having issues with zparseopts and it looks like Brew didn't install it correctly. See this simple test below (all similar tests fail):
❯ short_test_zpo() {
  autoload -Uz zparseopts || { echo "🔴 Autoload FAILED"; return 1; }
  local my_flag
  zparseopts -E -- f=my_flag -- "$@" # Use "$@" to pass args from func call
  if (( ${#my_flag[@]} )); then
    echo "✅ zparseopts PARSED the -f flag."
    echo "   Remaining args: $@"
  else
    echo "❌ zparseopts DID NOT parse the -f flag (or -f was not given)."
    echo "   Remaining args: $@"
  fi
}


❯ short_test_zpo some arg
short_test_zpo:3: zparseopts: function definition file not found
❌ zparseopts DID NOT parse the -f flag (or -f was not given).
   Remaining args: some arg
I read online that perhaps zparseopts is expected to be under functions, but that doesn't seem to be the case for me:
❯ ls -l $(brew --prefix)/share/zsh/functions/zparseopts

ls: /opt/homebrew/share/zsh/functions/zparseopts: No such file or directory
Reinstalling zsh works successfully (see the trace below), but does not seem to make a difference:
❯ brew reinstall zsh
==> Downloading https://ghcr.io/v2/homebrew/core/zsh/manifests/5.9-3 
Already downloaded: /Users/amelio/Library/Caches/Homebrew/downloads/2913dc2cb6e58f61f4261bc20839152f766b9eaf2f55e601c528b77f4c91a364--zsh-5.9-3.bottle_manifest.json
==> Fetching zsh
==> Downloading https://ghcr.io/v2/homebrew/core/zsh/blobs/sha256:93cacab325d2a9 
Already downloaded: /Users/amelio/Library/Caches/Homebrew/downloads/655b05f05860b07b382da3cd3866feb12706ed25b0a4d381ff276f1ba84c6d18--zsh--5.9.arm64_sequoia.bottle.3.tar.gz
==> Reinstalling zsh
==> Pouring zsh--5.9.arm64_sequoia.bottle.3.tar.gz
🍺  /opt/homebrew/Cellar/zsh/5.9: 1,579 files, 16MB
==> Running brew cleanup zsh...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).
### My output from brew config:
❯ brew config
HOMEBREW_VERSION: 4.5.3
ORIGIN: https://github.com/Homebrew/brew 
HEAD: dc0f9d50fd170492a33fd7234d06de1b94df363c
Last commit: 4 days ago
Branch: stable
Core tap JSON: 28 May 05:12 UTC
Core cask tap JSON: 28 May 05:12 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.4.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.4/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.5-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: N/A
Rosetta 2: false
### My output from brew doctor
❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  icu4c@76

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libfido2.1.14.0.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected header files:
  /usr/local/include/fido.h
  /usr/local/include/fido/*

Warning: Unbrewed '.pc' files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected '.pc' files:
  /usr/local/lib/pkgconfig/libfido2.pc
Any suggestions on what may be going on, or what I could try to diagnose further?
Asked by Amelio Vazquez-Reina (42851 rep)
May 29, 2025, 09:38 PM
Last activity: Jun 10, 2025, 01:19 PM