nicooprat / alfred-ocr

Take a snapshot and recognize text
MIT License
65 stars 7 forks source link

/bin/bash: line 4: tesseract: command not found #12

Open toobluescientist opened 3 years ago

toobluescientist commented 3 years ago

when I run the workflow, the pasted clipboard appears this: /bin/bash: line 4: tesseract: command not found

how to fix it?

I ran tesseract in Terminal and it worked well but not in Alfred.

nicooprat commented 3 years ago

Hi, can you try to restart Alfred after installation?

1activegeek commented 3 years ago

I'm running into this issue as well. I have it running on my old mac, but trying to install on my new Mac, I've hit a snag. I think it may be relative to how Alfred runs scripts and evaluates the PATH. You'll see here that I do in fact have tesseract installed and responding via its name on the command line, yet the script when run from Alfred, is not working.

Screen Shot 2021-05-05 at 12 01 37 PM

I did the following:

Finally was able to make this work by manually adding the location of tesseract (via homebrew) to the path list in the Run Script portion of the workflow. So I modified line 1 export PATH=/usr/local/bin/:$PATH to export PATH=/usr/local/bin/:/opt/homebrew/bin:$PATH. If you don't know where your install is running from, run which tesseract from the command line to identify. I'm on a Mac here obviously, but you should be able to adapt to Linux as well.

To Dev - I think this just means there needs to be a more robust way built in to identify the location of the tesseract binary if coming from the PATH variable.

dsbekker commented 3 years ago

Just to expand on this slightly. The issue affects apple silicon (M1) macs.

Homebrew on ARM installs to /opt/ as opposed to /usr/ on intel macs.

blindborges commented 2 years ago

I'm running into this issue as well. I have it running on my old mac, but trying to install on my new Mac, I've hit a snag. I think it may be relative to how Alfred runs scripts and evaluates the PATH. You'll see here that I do in fact have tesseract installed and responding via its name on the command line, yet the script when run from Alfred, is not working.

Screen Shot 2021-05-05 at 12 01 37 PM

I did the following:

  • Installed tesseract via homebrew, attempted removing and reinstalling - and then performing all steps below again as well
  • Quit Alfred completely and restarted to ensure it had caught all updates
  • Quit Terminal and restarted to ensure path was updated for all instances
  • Attempted running tesseract command by itself (as seen in this screenshot)
  • Tried altering the script to use /bin/zsh instead

Finally was able to make this work by manually adding the location of tesseract (via homebrew) to the path list in the Run Script portion of the workflow. So I modified line 1 export PATH=/usr/local/bin/:$PATH to export PATH=/usr/local/bin/:/opt/homebrew/bin:$PATH. If you don't know where your install is running from, run which tesseract from the command line to identify. I'm on a Mac here obviously, but you should be able to adapt to Linux as well.

To Dev - I think this just means there needs to be a more robust way built in to identify the location of the tesseract binary if coming from the PATH variable.

I'm stuck in the same problem.

I installed tesseract via macports because brew was not working.

And my tesseract is at "/opt/local/bin/tesseract"

I tried to fix export path as many as I could, but all of them didn't work.

Can you give me an advice?

nicooprat commented 2 years ago

Those path issues are really annoying. Could you try to use /bin/zsh instead of /bin/bash if you're using latest Mac version?

image

blindborges commented 2 years ago

Yes, it is really annoying. I thought I was so close, but It didn’t work.

I will try.

Thanks for replying.

nicooprat commented 2 years ago

Looks like this is a common issue in Alfred plugins, you can take a look here to see what's done in PHP :D

https://github.com/tillkruss/alfred-lorem-ipsum/issues/6#issuecomment-1006756654

blindborges commented 2 years ago

Thanks for helping me out again.

I really appreciate it.

2022년 1월 31일 (월) 오후 10:49, Nico Prat @.***>님이 작성:

Looks like this is a common issue in Alfred plugins, you can take a look here to see what's done in PHP :D

tillkruss/alfred-lorem-ipsum#6 (comment) https://github.com/tillkruss/alfred-lorem-ipsum/issues/6#issuecomment-1006756654

— Reply to this email directly, view it on GitHub https://github.com/nicooprat/alfred-ocr/issues/12#issuecomment-1025758198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXQTU2EGGE5KTRUPCOKJWG3UY2HPXANCNFSM424ZEXKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>