alfred-encode-decode-workflow
alfred-encode-decode-workflow copied to clipboard
Problem with macOS 12.0.1
After installing php with brew, and set language to "/opt/homebrew/bin/php"
I get these using encode:

After installing php with brew, and set language to "/usr/local/bin/php"
PHP Version: PHP 8.0.12 (cli) (built: Oct 21 2021 14:38:26) ( NTS )
Alfred Version: Alfred 4.6 [1266]
I get these using encode:

After installing php with brew, and set language to "/usr/local/bin/php"
PHP Version: PHP 8.0.12 (cli) (built: Oct 21 2021 14:38:26) ( NTS )
Alfred Version: Alfred 4.6 [1266]
I get these using encode:
hi,I have a solution.
first, you must make sure PHP is installed。If not, you can run
brew install php
then, you should edit script filter. For encode script, edit as
/usr/local/bin/php encode.php $1
like

@Zhengxiuhang thanks, it's work. #25
setting: with input as argv
encode: /usr/local/bin/php encode.php $1
decode: /usr/local/bin/php decode.php "$(./normalise -form NFC "$1")"
Same issue here. No matter with argument or query.
PHP version: PHP 8.0.13 (cli) (built: Nov 19 2021 08:51:23) ( NTS ) Alfred version: 4.6.1 Mac OS version: Monterey 12.0.1 Architecture: Apple M1
+1 for me. I fixed some of the errors in workflows.php, but gave up after a bit. Looks like the new php doesn't like it.
PHP 8.1.0 (cli) (built: Nov 28 2021 01:44:44) (NTS) macOS 12.0.1 (21A559) Alfred 4.6.1 [1274]
I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed [email protected] and it works.
So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:
- brew install [email protected]
- brew unlink php
- brew link [email protected] --force
I also have updated the php as described in the project Readme changing
phpto/usr/local/bin/php.
Thanks to @robertovg for correctly pointing out that the issue is, currently, that the workflow is incompatible with newer versions of PHP.
However, instead of the potentially disruptive workaround of force-linking PHP 7.4 brew-wide, I was able to get everything working just by passing in the versioned, non-linked keg path:
/opt/homebrew/opt/[email protected]/bin/php decode.php "$(./normalise -form NFC "$1")"
Got it working (I'm now on macOS 12.1, Alfred 4, which may have broken more things):
- brew install [email protected]
- link to php in keg for both encode and decode Script Filters - for me it was
/usr/local/opt/[email protected]/bin/php - hack workflows.php:
- Change line 307 (
defaults read) toexec( 'plutil -extract '.$a.' raw "'. $b .'"', $out ); // Execute system call to read plist value(defaults read from filepath seems to have stopped working, though the manpage still says that's not happening until "an upcoming major release". - Update cache partial path in line 41 to
/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/(instead ofAlfred-2which doesn't exist for me and the script doesn't create it if missing. - [Optional] Update workflow partial data path from
Alfred-2toAlfred
- Change line 307 (
I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed
[email protected]and it works.So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:
- brew install [email protected]
- brew unlink php
- brew link [email protected] --force
I also have updated the php as described in the project Readme changing
phpto/usr/local/bin/php.
it works, here is my settings:

can anybody fix the php version bug? I want to use the lastest php version!
The reason it does not work with latest PHP versions is that an issue that previously was a notice (accessing a non-existing index) became a warning in PHP 8, making the output no longer be valid JSON.
A relatively easy workaround to get it to work with PHP 8 is to suppress warnings altogether:
php -d error_reporting="E_ERROR | E_PARSE" encode.php "$(./normalise -form NFC "{query}")"
I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed
[email protected]and it works.So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:
- brew install [email protected]
- brew unlink php
- brew link [email protected] --force
I also have updated the php as described in the project Readme changing
phpto/usr/local/bin/php.
That's good for me. In fact no need to unlink-php,just need change 'php' to '/opt/homebrew/opt/[email protected]/bin/php'
Hello, I used to use willfarrell/alfred-encode-decode-workflow, but it required php@7, and macOS removed php@7 now.
I'm waiting for a long time, but it seems that the author has no time to update it.
So I decided to write a new one. It must be simple and have no dependencies.
Ande the new one is here. https://github.com/alswl/alfred-workflow-encode-decode
It's written in Python, and it's simple and easy to use, and maybe you can use this one now.
Thanks a lot for the author of willfarrell/alfred-encode-decode-workflow.
Here is how I solved this issue (Monterey 13.4 running on an M1 chip).
The Encode/Decode Alfred workflow requires PHP version 7.4 in order to work.
However, I already have version 8.1 installed.
Here is the workaround.
- I previously installed the latest PHP (version 8.1 back in the day)
brew install php - Install PHP version 7.4 using a tap so that both versions can coexist
brew tap shivammathur/php brew install shivammathur/php/[email protected] - Edit the Encode/Decode Alfred workflow
- Double-click the
encodeanddecodefilters Replacephpwith/opt/homebrew/opt/[email protected]/bin/php
- Double-click the