willfarrell / alfred-pkgman-workflow

Package Repo Search
MIT License
699 stars 57 forks source link

/bin/bash: php: command not found #159

Closed carter-lavering closed 2 years ago

carter-lavering commented 2 years ago

This has gotta be something so basic that I am overlooking, as I'm somewhat unfamiliar with scripting and such. It seems like Alfred isn't able to read my PATH variable and figure out where php is. If I run php from a terminal window (either bash or zsh) it opens just fine, but trying to search any repo with this workflow immediately crashes:

[16:49:44.599] Package Managers[Script Filter] Queuing argument ''
[16:49:44.666] Package Managers[Script Filter] Script with argv '(null)' finished
[16:49:44.668] ERROR: Package Managers[Script Filter] Code 127: /bin/bash: php: command not found

Every repo I've tried throws an error identical to this. It seems like it might be a permissions issue, but Alfred has Automation and Full Disk Access permissions.

Sorry that this is somewhat off topic, I just wasn't sure where else to ask. Thanks!

carter-lavering commented 2 years ago

Never mind! Found details in #158 that helped fix my issue, by adding a PATH workflow environment variable with /opt/homebrew/bin:$PATH. All is working now!

carter-lavering commented 2 years ago

And through further trial and error (and reading) I have found that $PATH expansion is not supported, so even though search seemed to be working at first glance, nothing else was. I've replaced $PATH with /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin (again, per #158) and everything works now.

jeffbyrnes commented 2 years ago

@carter-lavering so yeah, Alfred’s owners/maintainers set it up so that Alfred uses its own internal logic (not $PATH) and if it finds PHP at one of the two locations Homebrew uses by default (/usr/local/bin on Intel Macs, /opt/local/bin on Apple Silicon Macs) it uses that location, otherwise it falls back to /usr/bin/php, the old location on pre-Monterey macOS.

carter-lavering commented 2 years ago

I'm running Apple Silicon and my Homebrew installed to /usr/homebrew/bin (which, according to the Homebrew docs, is the default), but I guess I need to take that up with the Alfred devs and not here. Thanks for the clarification!