Scenario: working away in Terminal, get an error message. Want to google it so I select text and use right-click and "Search with Google". Opens Safari every time. Google Chrome is my default browser. I've restarted the machine twice since I confirmed that.


Search with Google is a service provided by Safari and has nothing to do with Terminal.

Google Chrome should provide its own service for this feature. It doesn't.

Or you can write your own, e.g. using Automator and AppleScript:

Open Automator and select to create a new Service. At the top, select text and any application. Then, add a Run Shell Script action from the library to the workflow by drag&drop or double-clicking. Change its input to as arguments, and paste the following script in its main text area:

function urlencode {
    echo -n "$@" | perl -MURI::Escape -ne 'print uri_escape($_)'
open "http://google.com/search?q=$( urlencode "$@" )"

Automator screenshot

This will open the URL http://google.com/search?q= followed by your URL-escaped text selection in your default browser.

Save as Search with Google in Default Browser and try again.

| improve this answer | |
  • 1
    1. How do i get this service to appear in the main contextual menu, like Safari's does? – aaronbauman Sep 29 '14 at 19:09
  • 2. How can I get rid of Safari's service in the contextual menu? – aaronbauman Sep 29 '14 at 19:10
  • 3
    @aaronbauman Disable it in System Preferences » Keyboard » Shortcuts » Services. This will remove it also from the Services submenu in the application menu though, and disables its keyboard shortcut, if set. – Daniel Beck Sep 29 '14 at 19:21
  • Safari is just a browser—it may be provided with Safari, but it is provided by Apple, and Apple has no business pulling stupid shenanigans like this. The OS needs to honor the user's choice of default browser, and so do other utilities (including Services) that Apple provides. Please complain to Apple at apple.com/feedback and tell them this is absolutely unacceptable. – iconoclast Mar 16 '16 at 19:34
  • Thanks Daniel! perl -MURI::Escape didn't work out of the box, so I used that instead: open "http://google.com/search?q=$( python -c 'from urllib import quote; print quote(raw_input(), safe="")' <<< "$*" )" – Piotr Findeisen May 6 '17 at 20:26

You must log in to answer this question.

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