Josh Dick portrait Josh Dick

Send Browser Tabs from iOS to Mac with Workflow, Hazel and Dropbox

A somewhat complex solution to a simple problem.

Introduction

I’ve always wanted to be able to send a tab from an iOS web browser to a Mac web browser. Despite the existence of browser features like Safari’s iCloud Tabs and Google Chrome’s Tab Syncing, or even services like Instapaper or Pocket, I wanted a way to “send and forget” a browser tab from an iOS device to a Mac for future reference, then close the tab on my iOS device without giving it another thought.

When Workflow for iOS launched in December 2014, I knew that I could use it to implement this idea.

The system described below should work with any iOS browser that uses the standard iOS share sheet, as well as any Mac browser on the receiving end. I’ve tested this system with different combinations of Chrome and Safari on both sides, and it works great in all cases.

I will not go into step-by-step detail for configuring Workflow or Hazel, so if you’re new to either of them, you should download them and experiment with them before continuing.

How It Works

This is how the system works from end to end, which should give you some context before you start configuring things:

  • On iOS, a Workflow Action Extension that accepts URLs is invoked through the browser’s share sheet.
  • The workflow prompts for a Mac to send the tab to, and then saves the URL in a text file, located in a Dropbox folder corresponding to the chosen Mac.
  • A Hazel rule on the chosen Mac continuously monitors that same Dropbox folder for changes.
  • If a new file is detected in the folder, the rule reads its contents (the URL), and opens that URL in your Mac browser of choice.
  • The rule then deletes the file since it is no longer needed.

Prerequisites

  • Workflow must be installed on all iOS devices you want to send tabs from.
  • Dropbox and Hazel must be installed on all Macs that will receive sent tabs.

Configure Dropbox

Make a list of all Macs you want to be able to send tabs to. My Macs are named after characters from the television show Archer, so my list looks like this:

  • archer
  • cheryl
  • malory

If you aren’t weird enough to name your computers, your list might include things like “MacBook Pro” and “iMac”.

Create a new folder anywhere in your Dropbox called “Send Tab” or anything else that works for you, and then create subfolders inside it for each Mac on your list.

My directory structure looks like this:

$ tree ~/Dropbox/App\ Databases/Workflow/Send\ Tab
/Users/Josh/Dropbox/App Databases/Workflow/Send Tab
├── archer
├── cheryl
└── malory

3 directories, 0 files

Configure Hazel on your Macs

The Hazel rule shown below should be configured for each Mac on your list.

On each Mac, the rule should be configured to monitor the corresponding Dropbox subfolder that you created for that Mac.

You can change "Google Chrome" to any browser you want, and you can opt to use different browsers on different Macs if you wish. Make sure that the browser you choose is inside your Mac’s /Applications folder, that you type the browser’s name exactly as it appears there, and that the browser’s name is quoted, as shown.

Hazel rule configuration

For your copying-and-pasting convenience, here’s the script that is embedded in the Hazel rule:

url=`cat "$1"`
open -a "Google Chrome.app" "$url"
rm -f "$1"

Configure Workflow on your iOS Devices

The Workflow workflow (not a typo!) shown below should be configured on each iOS device you want to send tabs from.

This workflow is an Action Extension workflow that is configured to accept URLs.

For convenience, you can install the workflow by visiting this link on your iOS device instead of reconstructing it manually.

If you’re curious, here’s what the workflow looks like:

Hazel rule configuration

You’ll need to customize the list of Macs, as well as the “Destination Path” in the “Save to Dropbox” action.

A key point is that the Destination Path ends with a variable that corresponds to the selected Mac. For reference, my Destination Path looks like this, although it doesn’t all fit on the screen in the Workflow app: App Databases/Workflow/Send Tab/<computer>. This means that the Macs in the workflow’s list need to match their corresponding subfolder names in Dropbox.

The Finish Line

Now that you’ve finished configuring Hazel and Workflow, you should be able to send browser tabs from your iOS device(s) to your Mac(s), like this:

Closing Thoughts

As of this writing, Hazel and Dropbox don’t always work together on OS X Yosemite. If Workflow is adding files to your Dropbox but the Hazel rule never triggers on its own/only works when run manually, try this workaround I that discovered through experimentation: Create a folder somewhere outside Dropbox on your Mac, configure the Hazel rule to watch it. Then, symlink that folder into your Dropbox folder, in a location that it will appear as that Mac’s “send tab” subfolder (to match the iOS workflow.)

Here’s an example of how to set up the workaround:

$ ln -s ~/path/to/the/real/folder/cheryl ~/Dropbox/App\ Databases/Workflow/Send\ Tab/cheryl

Allowing Hazel to watch the non-Dropbox folder allows Hazel’s automatic rule triggering to work, while still allowing Dropbox syncing to work via the symbolic link.

If you’re obsessed with sending tabs between devices like me, you might enjoy these two relevant free utilities:

  • CloudyTabs, which is a Mac menu bar application that simply lists iCloud tabs across all devices. It’s useful if you like using Safari on your iOS devices and a different browser on the Mac.
  • Chrome2ChromeV2, which allows you to send tabs between Google Chrome sessions on any computer, as long as you’ve signed into Chrome with a Google account on the desired computers.

Updated on January 28, 2015: Updated the Hazel rule embedded script and associated screenshot to use and be compatible with bash — which is the default for most users — instead of zsh.

[ ↩ all writing posts ]