Just a hint to fix the language issue; adding a check if a paramter was given helps in tesseract 4; remember that the language attributes are a little weird (eng for english, deu for german etc.) thanks a lot for the script
export PATH=/usr/local/bin/:$PATH
screencapture -i /tmp/ocr_snapshot.png
if [{query} = ""]; then
tesseract /tmp/ocr_snapshot.png stdout 2>&1
else
tesseract /tmp/ocr_snapshot.png stdout -l {query} 2>&1
fi