I recently upgraded from Mac OS Mojave to Catalina. On Mojave, I used a quick action to perform web searches via Google's encrypted search engine at encrypted.google.com. The quick action script is open "https://encrypted.google.com/search?q=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp')".

This script no longer works in Catalina due to deprecated Ruby support. Does anyone know how I could script the same action in Catalina?

  • 1
    You could install Ruby via Homebrew.
    – nohillside
    Commented Dec 20, 2021 at 15:56
  • Or you could install Ruby via MacPorts.
    – Seamus
    Commented Dec 21, 2021 at 0:25
  • Thanks for the suggestion. I did eventually install Ruby via macports, but that, for some reason, didn't fix my issue. Commented Jan 2, 2022 at 12:18

1 Answer 1


Since you have both the applescript and automator tags on your question, here is another approach using a Run AppleScript action in Automator...

I'd use 'Listing 32-7 AppleScriptObjC: Handler that URL encodes text' from Encoding and Decoding Text.

Example AppleScript code:

use framework "Foundation"
use scripting additions

on run {input, parameters}
    open location "https://encrypted.google.com/search?q=" & encodeText(input as string)
end run

on encodeText(theText)
    set theString to stringWithString_(theText) of NSString of current application
    set theEncoding to NSUTF8StringEncoding of current application
    set theAdjustedString to stringByAddingPercentEscapesUsingEncoding_(theEncoding) of theString
    return (theAdjustedString as string)
end encodeText

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .