squatto/alfred-imessage-2fa

Not working on macOS 12

bwoodruff opened this issue ยท 12 comments

Version Info

  • OS: macOS 12.0 Beta (21A5248p)
  • Alfred: 4.3.4 [1229]
  • iMessage 2FA: 1.2.6

STR

  • Open Alfred
  • Begin typing the keyword for the iMessage 2FA workflow (mine is set to "2fa" but I've also tried the default "otp")
  • When the workflow comes up press enter/return

Expected behavior

The list of available OTP codes from iMessage should be shown

Actual behavior

I'm only offered to search for my workflow activation keyword through established search providers

Additional info

I'm not sure if this is an issue with the workflow or with Alfred itself...

2021061634yiC6J9

That's really strange. The default keyword is actually "2fm" - did you change it to "2fa" within the workflow itself?

image

Assuming you did change that and the workflow is failing, would you mind enabling debug mode on the workflow and pasting the output you get when you try to trigger it? If you haven't ever done that, this is how:

image

Thanks!

@squatto Thanks! I did change it. I tried changing it back to 2fm to see if it made any difference and it did not. Here is the error in debug mode:

[13:15:46.538] ERROR: iMessage 2FA[Script Filter] Code 127: /Users/bdw/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D5393552-2A9F-40B6-8CB5-81F987CBFD48: line 1: php: command not found

Which makes sense since macOS no longer ships with php... ๐Ÿ˜ญ
Source: https://developer.apple.com/forums/thread/681907

Ah yep, that would definitely do it...and that's good to know! It's a double-edged sword IMO. The php version it shipped with was old and tended to cause problems, so it usually had to be replaced/upgraded. It would handle scripts that weren't terribly complex though. But just plain not including it is likely going to cause dependency problems for a lot of apps. We'll have to see what happens as it moves through betas.

If you use homebrew you can just do brew install php. It shouldn't affect anything else, as far as I'm aware. YMMV of course ;)

Tried homebrew to install php, but:

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump

womp womp. Too many yaks to shave at the moment. Thanks much for helping track this down though!

Too many yaks to shave...I'm going to have to start using that one ๐Ÿ˜‚

I poked around a little and found this helpful page. According to that you actually just need to run arm brew install php and you should be all set ๐Ÿคž๐Ÿป

Oh duh, actually you'll need to follow the instructions on that page first to create that arm bash command. It also shows you how to install ARM-compatible homebrew on that page.

Too many yaks to shave...I'm going to have to start using that one ๐Ÿ˜‚

๐Ÿ˜

Thank you for your continued efforts here. Making progress...

$ php -v
PHP 8.0.7 (cli) (built: Jun  4 2021 03:56:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies
$ which php
/usr/local/bin/php
$ php -v
PHP 8.0.7 (cli) (built: Jun  4 2021 03:56:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Users/bdw/1password-toolchain-macos/bin:/Users/bdw/.cargo/bin

But:

[14:07:06.065] ERROR: iMessage 2FA[Script Filter] Code 127: /Users/bdw/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/A6842757-0757-4416-A956-DA5579E7FA26: line 1: php: command not found

Tried quitting and relaunching Alfred to no avail

Excellent progress for sure!

Edit the "Script Filter" step of the workflow and change the "Script" to this:

/usr/local/bin/php find-messages.php $look_back_minutes

That should do it ๐Ÿคž๐Ÿป

image

That did indeed do it ๐Ÿ’ฏ

Thanks so much!

Excellent!! You're very welcome. I'm glad that I could help. Thanks for working through it with me as well. I don't plan on upgrading to an ARM Mac any time soon so it's good to know that it's possible to get it working on one.

Slight mod to make it work on my other machines:

export PATH=/usr/local/bin:$PATH
php find-messages.php $look_back_minutes

Good call. You'd think that macOS would put /usr/local/bin in your path by default ๐Ÿค”