Skip to content

Instantly share code, notes, and snippets.

@CorySanin
Created November 1, 2025 17:45
Show Gist options
  • Select an option

  • Save CorySanin/d322dc6ebe534c23ba183920d154e566 to your computer and use it in GitHub Desktop.

Select an option

Save CorySanin/d322dc6ebe534c23ba183920d154e566 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# firefox-init
# -----------
# This script disables many annoyances that may
# disuade new users from using Firefox at all.
# It also installs uBlock Origin, though it needs
# to be enabled via Firefox
#
set -euxo
which curl
which firefox
if [ -d "$HOME/.mozilla" ]; then
echo "mozilla directory present. Exiting."
exit 2
fi
firefoxRunOnce () {
firefox &
local PID=$!
sleep 5
kill "$PID" 2>/dev/null
}
firefoxRunOnce
PROFILE=$(basename "$HOME/.mozilla/firefox/"*.default-release)
INSTALLTIME=$(date +%s)000
curl -L -o "$HOME/.mozilla/firefox/$PROFILE/extensions/[email protected]" \
https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon.xpi
echo '
user_pref("browser.newtabpage.activity-stream.showSponsored", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredCheckboxes", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
user_pref("datareporting.healthreport.uploadEnabled", false);
user_pref("browser.urlbar.suggest.quicksuggest.nonsponsored", false);
user_pref("browser.urlbar.suggest.quicksuggest.sponsored", false);
' > "$HOME/.mozilla/firefox/$PROFILE/prefs.js"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment