Toggle Cloudflare WARP on a Mac

For those who aren’t aware, Cloudflare offers a great alternative to the vast majority of VPN providers. What’s cool about it is that it’s absolutely free and doesn’t even require an account. I have been using it for a couple of years already on all of my devices, including my Mac, mainly to access restricted websites in my country.

The app lives in the menu bar and is as easy as pie: you click on the app icon and then click a huge toggle to turn WARP on or off. Still, it takes a couple of clicks to toggle it, which becomes a bit annoying, especially when you are using Bartender or a similar app to hide menu bar icons. Unfortunately, WARP doesn’t support hotkeys, but luckily for me, it can be controlled from the CLI, which eventually means it can be controlled by the macOS Shortcuts app.

My fellow programmer (chatGPT) kindly wrote a simple script to automatically switch to WARP if it’s disconnected and disconnect otherwise.:

if [[ $(warp-cli status) == "Status update: Disconnected"* ]]; then
    warp-cli connect
else
    warp-cli disconnect
fi

Here’s how it all looks in macOS Shortcuts:

https://www.icloud.com/shortcuts/f569ae067f2240eeb65d2776926e3006

Still, it doesn’t change much because macOS Shortcuts doesn’t support hotkeys. No big deal: I’m using Raycast, where I can assign a hotkey to any shortcut:

Now, whenever I need WARP enabled, pressing Option + Shift + ` toggles the connection on and off.

Hi! I’m Roman, a Google Ads freelancer. This is my website where I share all kinds of things I find interesting related to Google Ads, Google Tag Manager, and Google Analytics. I am also available for hire, so if you need help with any of these, feel free to get in touch.

Leave a Reply

Your email address will not be published. Required fields are marked *