squatto / alfred-imessage-2fa

iMessage 2FA Workflow for Alfred
MIT License
111 stars 7 forks source link

Not working on macOS 12 #23

Closed bwoodruff closed 3 years ago

bwoodruff commented 3 years ago

Version Info

STR

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

squatto commented 3 years ago

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!

bwoodruff commented 3 years ago

@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

squatto commented 3 years ago

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 ;)

bwoodruff commented 3 years ago

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!

squatto commented 3 years ago

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 🤞🏻

squatto commented 3 years ago

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.

bwoodruff commented 3 years ago

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

squatto commented 3 years ago

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

bwoodruff commented 3 years ago

That did indeed do it 💯

Thanks so much!

squatto commented 3 years ago

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.

bwoodruff commented 3 years ago

Slight mod to make it work on my other machines:

export PATH=/usr/local/bin:$PATH
php find-messages.php $look_back_minutes
squatto commented 3 years ago

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