Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.


Repository files navigation

Archived 11 February 2024: this was a fun experiment in using Rust, but I'm no longer using or maintaining it – I've replaced it with JavaScript For Automation (JXA) scripts that I run directly. provides some tools for interacting with Safari on the command-line.


  1. Get the URL from a given window or tab:

    $ # Get the URL of the frontmost tab of the frontmost window
    $ safari url
    $ # Get a URL from the second window from the tab
    $ safari url --window=2
    $ # Third tab from the left of the second window
    $ safari url --window=2 --tab=3

    I have the first two commands bound to shortcuts furl and 2url for quick access.

  2. Get a list of URLs from every open tab:

    $ safari list-tabs
  3. Go through and batch close tabs:

    $ safari clean-tabs,

    I find this useful for quickly cutting down my open tabs.

  4. Get a list of URLs from Reading List:

    $ safari reading-list
  5. Get a list of URLs from all your devices with iCloud Tabs:

    $ safari icloud-tabs

    You can get a list of known devices with icloud-tabs --list-devices, and filter the URLs with the --device flag:

    $ safari icloud-tabs --device="Alex's iPhone"


You need Rust installed. Then to install:

$ cargo install --git

It's tested in Travis with the current version of stable Rust, but it only gets tested when it was last modified (at time of writing, that was Rust 1.40.0).

URL transformations

The commands that produce URLs do a bit of cleaning before they return:

  • Convert links for a mobile site to the desktop site – for example, converting to
  • Stripping tracking junk (e.g. UTM tracking parameters) from URLs.
  • Removing some extraneous information that isn't generally useful.


I first got the idea for a script to access Safari URLs from Dr. Drang. I've been through several different versions – AppleScript, shell, Python – gradually adding the cleaning features – and now I've written a new version in Rust.

Why Rust?

  • It's really fast. The Rust script returns immediately – when I tried writing this with Python, I had a noticeable delay when typing ;furl. This is a tool I use dozens of times a week, so every second counts.
  • I like Rust, and I’ve been enjoying playing with it recently.