Home

Awesome

 

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.adtidy.org/public/Adguard/Common/Logos/safari_dark.svg" width="300px" alt="AdGuard for Safari" /> <img src="https://cdn.adtidy.org/public/Adguard/Common/Logos/safari.svg" width="300px" alt="AdGuard for Safari" /> </picture> </p> <h3 align="center">The most advanced ad blocking extension for Safari</h3> <p align="center"> Free and open source, highly customizable and lightning fast ad blocking extension. </p> <p align="center"> <a href="https://adguard.com/">AdGuard.com</a> | <a href="https://reddit.com/r/Adguard">Reddit</a> | <a href="https://twitter.com/AdGuard">Twitter</a> | <a href="https://t.me/adguard_en">Telegram</a> <br /><br /> <a href="https://agrd.io/safari"> <img src="https://img.shields.io/badge/download-app%20store-blue.svg" alt="Download on the AppStore" /> </a> <a href="https://agrd.io/safari_release"> <img src="https://img.shields.io/github/release/AdguardTeam/AdguardForSafari.svg?label=release" alt="Latest release" /> </a> <a href="https://agrd.io/safari_beta"> <img src="https://img.shields.io/endpoint?url=https://shields-io-proxy.agrd.workers.dev/?repo=AdGuardTeam/AdGuardForSafari" alt="Latest beta" /> </a> </p> <br /> <p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.adtidy.org/content/github/ad_blocker/safari/dark_filters.png" width="800"> <img src="https://cdn.adtidy.org/content/github/ad_blocker/safari/filters.png" width="800"> </picture> </p> <hr />

AdGuard for Safari

Ad blocking extensions for Safari are having hard time since Apple started to force everyone to use the new SDK. AdGuard extension is supposed to bring back the high quality ad blocking back to Safari.

Unlike other major ad blockers, AdGuard provides some extra features you are used to have with the traditional (now deprecated) extensions:

AdGuard for Safari is based on the Safari native content blocking API, which makes it lightning fast, but somewhat limited in capabilities. For instance, Safari limits the number of rules a content blocker can have.

Better yet, there is a full-fledged AdGuard for Mac

With all above said, there is a solution that is even more effective than AG Safari extension. I mean, of course, AdGuard for Mac. It can:

You can try it out for free.

How to build AdGuard for Safari

AdGuard for Safari consists of three parts:

Prerequisites

Also, you need to install these packages globally:

yarn global add electron-packager
yarn global add node-gyp
yarn global add electron-osx-sign

How to build

To run application in development mode

cd ElectronMainApp

Install local dependencies by running:

yarn install

How to debug the app

Debug window

Launch the application via:

yarn start

Open menu View -> Toggle Developer Tools

Debug main process

Launch the application via

yarn inspect

Open URI chrome://inspect in Chromium

Then add a network target localhost:5858 via button "Configure" and select this target below.

Build and run in production mode

Replace the following line in file ./AdGuard/Config.xcconfig

AG_SIGN = <YOUR APPLE DEVELOPER COMMON NAME>

where <YOUR APPLE DEVELOPER COMMON NAME> is your codesign identity

Make sure your system Nodejs version higher v8.9.4.

Steps to check it: if you use nvm run

nvm use system
node -v

otherwise

node -v

Open AdGuard.xcworkspace in Xcode and run building project

How to run tests

cd ElectronMainApp
yarn test

Preparing and building Adguard.

Environment requirements

xcode-select --install
sudo gem install bundler
cd <repository>
./configure.sh dev

Check certificates names in Scripts/ExportOptions.plist

Building

SafariConverterLib dependency

For converting rules to content-blocker format we use an external library as a binary built from https://github.com/AdguardTeam/SafariConverterLib/, that ConverterTool binary should be placed in ./libs/.

You use ./Scripts/download-lib.sh to download the latest release version of that binary from Github.

Common issues

https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/resolving_common_notarization_issues

Use fixed electron-osx-sign

npm install -g electron-userland/electron-osx-sign#timestamp-server

How to release standalone builds

Build application

./build.sh <channel> [--notarize=0]

Arguments:

Output directory build contains:

Clean install