Use ChatGPT Anywhere on your Mac post image

Use ChatGPT Anywhere on your Mac

I don't need to stress how ChatGPT is revolutionizing how we write. One of the frictions of using ChatGPT is that it is only available on the web, which can be a bit of a hassle when you are writing in other applications -- you need to open ChatGPT webpage, sign in, then copy and paste the context (for example, if you want it to summarize an paragraph or polish your writing). These small steps can add up quickly to hours of wasted time.

What if you can call ChatGPT magically with a single click or a keyboard shortcut from any application? Read on.


  1. A working OpenAI API key
  2. macOS


Popclip is a paid macOS app that pops up a tooltip when you select text in any application. It is quite powerful when combined with extensions. Here is a demo with the ChatGPT extension I wrote.

To install this extension, select the following code and popclip should automatically prompt you to install.


Raycast serves as both a launcher and a command center and it's one of my favorite macOS apps. I used to be a paying user of Alfred, but I switched to Raycast because it allows me to develop a more useful ChatGPT plugin with a beautiful user interface. In contrast, Alfred only allows you to copy or paste the AI output.

The Raycast extension has several commands that comes with some prompts.

Several commands available in the Raycast Extension.
Several commands available in the Raycast Extension.

Here are what they do:

  • Preview: use your selected text (e.g., "Write me an email about blah blah") as the input, then stream the output to the Raycast UI.
  • Execute: Similar to preview, but directly pastes the result into your foreground application.
  • Summarize: summarize and explain the selected text for you.
  • Refine: Refine the writing of the selected text.
  • Rewrite: Rewrite the the selected text using an academic tone.

You can assign a dedicated keyboard shortcut to each of these commands. I personally use shortcuts like alt + :. For Summarize, Refine, and Rewrite, you may customize the prompt in the Extension settings. Here is the Summarize shortcut working in the wild:

The output from ChatGPT will stream to the Raycast UI, which allows you to copy the output to your clipboard using the keyboard shortcut enter or paste it directly into your foreground application using cmd + enter. If you are not happy with the output, you can regenerate the results with cmd + R. If the default gpt-3.5-turbo is not powerful enough for you, you may use cmd + shift + R to regenerate the result with gpt-4. You don't have to remember all these shortcuts, as Raycast also conveniently provide these options in the UI. Additionally, I have included some additional features, such as a token counter and a cost estimator.


  1. Install Raycast.
  2. Search for ChatGPT Quick Actions using the "Store" command in Raycast. Or click the button below:

  1. Follow the wizard to finish the setup. You will need to provide your OpenAI API key.

Raycast has their first-party AI integration currently in beta. It has more features but I like to keep everything under my control. For instance, it is unlikely that you will be able to use your own OpenAI API key with Raycast's AI integration.


For starters, you can customize the prompts and keyboard shortcuts in the settings.

Customize your prompts and keyboard shortcuts in the settings.
Customize your prompts and keyboard shortcuts in the settings.

If you are comfortable with modifying the source code, you can also add more commands to your liking. For example, you can add more commands or change the default model. First, you will need to install the extension from source:

cd ~/Developer # or wherever you want to store the extension
git clone
npm install
npm run dev

This set of commands should install the extension to Raycast. It's safe to kill the npm run dev process and close the terminal window.

Depending on the desired behavior of the new command, duplicate the execute.ts or rewrite.ts files. Declare your new command in the package.json file. For example, if you want to add a new command called New Command (the corresponding file is new_command.ts), add the following entry to the commands array:

  "name": "new_command",
  "title": "New Command",
  "description": "An example new command",
  "mode": "view"

If this command comes with its own prompt, add an entry to the preferences array:

  "name": "prompt_new_command",
  "title": "New Command Prompt",
  "description": "The prompt for the new command",
  "type": "textfield",
  "default": "Summarize the following text as concise as possible: \n\n",
  "required": false

You could then read this prompt from the preferences in the new_command.ts file:

const prompt = getPreferenceValues().prompt_new_command;

After you are done, run npm run dev to push the update locally to your Raycast.