Skip to content

Instantly share code, notes, and snippets.

@PMK
Created April 4, 2016 08:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PMK/22a0fde46bf497fd7d732baa07504071 to your computer and use it in GitHub Desktop.
Save PMK/22a0fde46bf497fd7d732baa07504071 to your computer and use it in GitHub Desktop.
Mozilla Firefox profile (w/ bookmarks, history and addons) backup Bash script for Mac OS X
#!/bin/bash
#####
# Created by PMK
# https://github.com/PMK
#
# License: Public Domain
#
# Creates a tar archive of the current active profile of Mozilla Firefox.
# The profile contains sessions, addons, bookmarks and history.
#
# Usage: $ backup_script.sh TARGET
#####
TARGET=$1
if [ -z "$TARGET" ]; then
TARGET='./'
fi
if [ ! -d "$TARGET" ]; then
mkdir $TARGET
fi
# Get the profile id
PROFILE_ID=$(grep Path ~/Library/Application\ Support/Firefox/profiles.ini | sed 's/Path=Profiles\///g')
PROFILE_PATH=~/Library/Application\ Support/Firefox/Profiles/
BACKUP_FILE_NAME=$(date '+%Y%m%d%H%M')-$(PROFILE_ID).tar.gz
tar -zcf $BACKUP_FILE_NAME $PROFILE_PATH/$PROFILE_ID
mv $BACKUP_FILE_NAME $TARGET
echo 'Done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment