Is there a program that will allow me to use Spotlight to search my Firefox bookmarks and open the browser window?

3 Answers 3

  • First, download this file to your desktop: ffmd.sh

  • Open a terminal, and run the following:

sudo mkdir /usr/local
sudo mkdir /usr/local/bin
sudo mv ~/Desktop/ffmd.sh /usr/local/bin/
sudo chmod 755 /usr/local/bin/ffmd.sh
sudo chown root:wheel /usr/local/bin/ffmd.sh

  • Now, schedule the task with crontab. The following line will schedule for 10 minutes:

0,10,20,30,40,50 * * * * /usr/local/bin/ffmd.sh > /dev/null 2>&1

This script is in the public domain, and intended for those with a little experience with UNIX.

the source is here.

  • 2
    It might be worthwhile to explain just what this script is doing (eg. "Basically it's a shell script that parses your bookmarks.html file and writes it out as .webbookmark files in the Spotlight cache -- which is what Safari does with its bookmarks" ripped from the source)
    – Chealion
    Sep 2, 2010 at 22:12
  • What is the wheel group?
    – Casebash
    Sep 4, 2010 at 13:08
  • Unfortunately this script is outdated. Firefox has a new bookmarks format. It actually doesn't look very difficult though. I will have a go a writing a new script if I ever get a chance
    – Casebash
    Sep 14, 2010 at 9:03

Here is a proof of concept ffmd_sqlite script that uses the Firefox places database. Webloc docs are created that will be found by Spotlight and can be opened with Firefox.

  • Hello, and welcome to Ask Different! Please do not simply link to raw scripts without providing context; if the code is yours, do explain what it does (and why it is “proof of concept”), if it is not, please link to a resource explaining it as well as giving a summary. Also, a usage note (how to install and run) would be helpful.
    – kopischke
    Oct 30, 2012 at 12:30
  • This script errors out for me in 2020. (macOS Catalina 10.15.2 and Firefox 72.0.2)
    – Nic
    Feb 3, 2020 at 18:53

I was able to update the script suggested by others to work on Mac OS Sonoma (Mac OS 14.3).

I haven't tested this with cron yet but you can copy/paste this into Mac OS terminal and it runs, at least for me:

set -k
# find the firefox bookmarks database
BOOKMARKSDB="`find $HOME/Library/Application\ Support/Firefox/Profiles -name places.sqlite`"
# make a copy to avoid lock errors
PLACESDB="$HOME/ff_temp_$(basename $BOOKMARKSDB)"

QUERY="select b.title, p.url \
from moz_bookmarks b \
left join moz_places p on (b.fk = p.id) \
where b.title is not null and b.title <> '' and p.url is not null and p.url <> '' \
order by b.title \
--LIMIT 10;"

# clear out and/or make the directory to hold the .webloc bookmark files
rm -rf $HOME/Library/Caches/Metadata/Firefox
mkdir -p $HOME/Library/Caches/Metadata/Firefox

# query for the bookmarks, and export each as a .webloc file
sqlite3 -separator "£££" "$PLACESDB" "$QUERY" | awk '
 FS = "£££"
 OFS = " " }
{{gsub(/[\/\\?%*:|"<>''\)\(`]/, "", $1);} print "echo \"{ URLN = \\\""$1"\\\"; URL = \\\""$2"\\\"; }\" > \"$HOME/Library/Caches/Metadata/Firefox/"$1".webloc\""}' | \
sed '{s/&/&amp;/g;}' | grep -v "javascript:" | zsh

# convert the webloc files to have a plist
find $HOME/Library/Caches/Metadata/Firefox/ -name '*.webloc' -exec plutil -convert binary1 -s {} \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .