ChatGPT解决这个技术问题 Extra ChatGPT

How to force Mac OS to open "Search with Google" in Chrome [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions about general computing hardware and software on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow. Closed 5 years ago. Improve this question

While using Mac OS, its very useful to use "Search with Google" tool in context menu to directly search selected text from error windows or other content:

https://i.stack.imgur.com/956pK.png

But problem is, that it always open Safari by default. I have Google Chrome as default browser, but it makes no sense.

Does anyone know how to force this option open in Google Chrome instead of Safari?

The solution on superuser.com/questions/369934 works pretty well.
This seems a bug / unwanted feature of OSX. What I would do is to provide feedback directly to Apple apple.com/feedback that way will be aware that some users are not happy with it.

C
Casper

The OP is not using the context menu in Chrome, and does not have the "Search Google for...." option.

The "Search with Google" entry is provided by Safari and won't work with another browser to my knowledge.

The closest thing that I found in my journey to provide the same desire was to create a service of your own using Automator.

Instructions:

Open Automator and choose Service as the type Add a "Run Shell Script" action by dragging it to the right pane 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= Save the service as "Search Google" Activate the service in System Preferences and optionally assign a keyboard shortcut. Once activated, "Search Google" will appear in the context menu


Thanks. I had to replace .com with my country specific co.in for Google address, otherwise it was opening only a blank google search page.
Thanks @YogeshUmeshVaity, good point. I've updated with a note for future visitors.
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.
"Services" are now called "Quick Actions" in Automator. I'm not sure why, but this has trouble with pdfs in Preview. I expect something needs to be done with the text format?
My problem is that while this adds an entry underneath the "services" menu, I still have the preconfigured "search with Google" that opens Safari at the top level. This is true even if the preconfigured one is unchecked in Preference. So,I still sometimes choose this by mistake (which appears to trigger a crash while sleeping). Any idea how to remove the unwanted preconfigured menu entry?
N
Nathan Tuggy

Be sure to choose "Search Google for..." near the top of the list in the right-click dialog box. If you choose "Search with Google" (near the bottom) it's still going to open Safari.


This is the wrong answer (see explanation below in answer from Casper)