4

When I right click and use the "Search Google for" different things happen. For one, if I am in Chrome it opens a new tab in Chrome and searches as I want. However, if I use this menu anywhere else in macOS, it uses Safari.

The system itself has the Services sub-component listed under Keyboard preferences or under the Finder menus. The Services sub-component lists lots of right-click menu items but does not let me change them. It lists "Search Google for", but it does not allow any customization.

How can I change this menu? I don't want Safari to open when I search.

  • have you made Chrome your default browser? (Chrome > Preferences... > Default browser) – dwightk Mar 28 at 17:15
  • Yes, the default browser is set to Chrome and it works fine in most cases. Like if I right click within Slack or something it opens Chrome just fine. Only when I use certain apps (Outlook, Finder, etc.) it will open Safari instead. – Joel Schoenberg Mar 28 at 17:21
  • Add PDF Preview to the list of problem apps that use Safari as the "Search with Google" right click menu. – Joel Schoenberg Mar 28 at 18:11
  • Also note that the right click menu shows the Safari icon next to the menu choice. Any ideas anyone? – Joel Schoenberg Apr 1 at 23:46
3
+50

This appears to have been answered on stackoverflow already and on SuperUser even earlier.

The "search with google" entry is added by safari and therefore cannot be edited. So the solution is to disable that one, create your own service using automator, and then assign the appropriate shortcut key that will take precedence over the built-in disabled one. This is actually what I was going to suggest until I found that someone else had already gone through it.

I've copied/pasted answer from SO here.

Instructions:

  1. Open Automator and choose Service as the type

  2. Add a "Run Shell Script" action by dragging it to the right pane

automator

  1. Add script

    open "http://www.google.com/search?q=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp')"

    Adjust the TLD as needed for your country specific Google page. ex: http://www.google.co.in/search?q=

    A comment to the SO answer suggests - instead of "Run shell script" you can also use "Run javascript", use script function run(input, parameters) { return "google.com/search?q=" + encodeURI(input) }, and stack additional action "Internet > Open webpages" underneath. It could work faster. Also see SU answer

  2. Save the service as "Search Google"

  3. Activate the service in System Preferences and optionally assign a keyboard shortcut. Once activated, "Search Google" will appear in the context menu

keyboard shortcuts

  • 1
    We should incorporate all of the relevant text from the link in case the other site deletes the question. It appears they feel it’s off topic and could delete the post and then we would lose access to the answer here. – bmike Apr 7 at 13:49
  • I suspect the correct answer is also to replace step 3 by the JS answer in Super user. This needs testing first. – Mark Apr 7 at 16:26
  • It would be better to make this as community wiki as it is a copy of other SO answers – Mark Apr 7 at 16:27
  • I don't know how to do that. You're welcome to do it or tell me how. – apocalysque Apr 7 at 16:47
  • I mean. It doesn’t really matter to me as the bounty got an answer, but I’d rather give the points to a person than have them wiped out in a community wiki. – dwightk Apr 8 at 12:19

You must log in to answer this question.

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