Fix PHP path for Alfred on Monterey
skotzko opened this issue · 4 comments
Because the /bin/bash
node of the workflow directly calls php
, the workflow breaks on Monterey with the following error:
/bin/bash: line 8: php: command not found
This is true even if the user has manually re-installed php
via brew
, per this guidance.
The fix I found in the Alfred forums was to add the PATH
into the top of the script, like so:
Added at top of script (see screenshot):
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
This fixed it, since Alfred's php upgrades don't reach into the script contents themselves.
Can you incorporate this into an updated version of workflow?
Super late reply, but this is no longer an issue with Alfred.
Alfred will automatically search for PHP install in the following directories.
/opt/homebrew/bin/php
/usr/local/bin/php
Alternatively, you can still define your path in the script.
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
Had same issue and none of the solutions worked for me.
Thanks to ChatGPT I found the issue -
there was a mismatch between the path where my PHP is located.
So, I used echo $PATH
in terminal to find out where all the good stuff are.
and then I've added this line to the "run script" block:
export PATH="added/the/path/from/terminal/here:$PATH"
Thank you @mikomagni - your workflow makes my life so much better <3
@greenronny, the new version allows you to overwrite the path without editing the code.