Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,061 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This guide is a collection of techniques for improving the security and privacy of macOS on Apple silicon Macs. It targets experienced users who want security practices commonly used by organizations, but is also suitable for novice users with an interest in privacy and security.

For organization-managed Macs, see the macOS Security Compliance Project, maintained by the U.S. National Institute of Standards and Technology.

This guide is provided "as is" - without warranties of any kind. You are solely responsible for any consequences of following it.


Basics

Apply general security best practices:

  • Create a threat model

    • Is your adversary a local eavesdropper, a criminal using common malware, or a well-funded and highly capable organization?
    • Define the threats or groups you are defending against and what they can realistically do.
  • Keep the system and software up to date

  • Encrypt sensitive data

    • Enable FileVault to encrypt internal storage.
    • Use a password manager for account credentials and consider encrypting especially sensitive files separately.
  • Ensure data availability

  • Click carefully

    • Ultimately, the security of a system depends on the capabilities and habits of its administrator.
    • Take care when installing new software: install it only from sources the developer identifies as official, such as their website or GitHub repository.

Threat modeling

The most important step to meaningfully improve security and privacy is to create a threat model: a general description of what you want to protect, who might try to access it, how they could do so, and which controls are worth usability trade-offs. This creates an understanding of potential adversaries and their motivations, which leads to stronger defenses.

Assets

Assets may include a phone, laptop, credentials, and personal information, such as browsing history.

List them in order of importance, starting with those most worth protecting.

Adversaries

Define whom you are defending against. Start by defining the motivation each adversary might have to attack important assets. Financial gain is a big motivator for many attackers, for example.

Capabilities

For each adversary, list what they can and cannot do, ranking them from least to most capable. For example, a casual thief operates opportunistically: they will likely be defeated by basic controls, such as screen lock and encrypted storage with strong passwords. A more sophisticated and determined adversary may require fully powering off a device when not in use to clear credentials from memory and stronger authentication mechanisms.

Mitigations

Choose the best mitigation for each threat. For example, avoid writing passwords on paper if a roommate might find them, or encrypt storage to protect its data if it is stolen.

Security should be balanced with usability: every mitigation should counter some adversarial capability to justify any inconvenience. Stop adding defenses when the remaining risks are acceptable for a situation. Revisit the model when devices, data, travel, work, or adversaries change.

Example model

The following table is an example of a simple threat model:

Adversary Motivation Capabilities Mitigation
Roommate See private chats or browsing history Close proximity; can see screen or observe credentials Use biometric (fingerprint or face) authentication, use privacy screen, keep phone locked when not using it
Thief Unlock phone and steal personal info and drain bank accounts, sell phone for money Observe password being entered, steal logged-in device left unattended Maintain physical custody of device at all times, lock devices when not in use, avoid typing password in public view, use Find My or similar services to track or remotely disable stolen devices
Criminal Financial gain Social engineering (tricking a user into revealing information or taking unsafe actions), readily-available malware, password reuse, exploiting vulnerabilities Sandbox software, enable OS security features, maintain software updates automatically
Corporation Marketing based on user data Telemetry and behavioral data collection Block network connections, reset device-specific identifiers, avoid adding payment data
Nation State/APT Targeted surveillance Passive surveillance of internet infrastructure, advanced encryption analysis Use open-source software, strong diceware credentials, hardware with secure element, shut down devices when not in use, tripwire/honeypot/canary tokens alerts

Read more about threat modeling.

Hardware

Apple silicon hardware provide hardware-backed security features, including Secure Enclave-based key protection and stronger boot security options. They are generally the preferred platform for the protections discussed in this guide.

Some Intel-based Macs, especially models with vulnerable T2-era hardware, are affected by hardware vulnerabilities that cannot be fully fixed by a macOS update.

Avoid non-Apple hardware running macOS and systems that do not support the latest macOS release, as Apple does not patch all vulnerabilities in legacy versions.

Apple accessories generally receive firmware updates through macOS and support current Bluetooth security features. For example, Bluetooth Low Energy (BLE) Privacy uses rotating device addresses to reduce tracking; third-party accessories may not support this feature.

Installing macOS

There are several ways to install macOS.

Install the latest supported version of macOS; newer versions of macOS include security fixes and other improvements not available in previous releases.

System activation

During installation, Apple silicon Macs contact Apple activation service to confirm that the device is not reported lost or stolen. Read about how this process works.

Apple Account

An Apple Account is optional for basic macOS use but required for the App Store and many Apple services. Review data privacy settings before enabling features.

Enable end-to-end encryption for iCloud and review Apple Account data.

App Store

The App Store is a software distribution platform where applications are reviewed by Apple.

App Store applications are required to use App Sandbox and Hardened Runtime (security features restricting what apps can do, making some attacks more difficult). It also offers automatic software updates.

Using the App Store requires an Apple Account, which can pose a privacy risk.

Virtualization

Virtualization enables another operating system to run in an isolated virtual machine. On Apple silicon, macOS can run supported macOS guests and Windows 11 for ARM using apps such as the following:

  • UTM - Follow the documentation to create macOS and other virtual machines.
  • VirtualBuddy - Application for virtualizing macOS 12+ on Apple silicon.
  • Bushel - A lightweight, free app. On first launch, select "Ask App Not to Track".
  • VMware Fusion - Now free under Broadcom. Clean UI, easy macOS setup, and supports Windows 11 ARM.
  • tart (CLI) - Command‑line application installed with Homebrew.
  • Parallels - Paid option with strong integration.

Warning

VMware requires a Broadcom account and acceptance of agreements before download. Parallels requires an account, payment details, and other data - see the privacy notice.

Apple containers

Apple Container is a command-line tool for running Linux containers on macOS. Unlike container runtimes that share a single Linux virtual machine, Apple Container runs each container in an isolated, lightweight virtual machine using macOS virtualization capabilities. This provides a stronger isolation boundary between workloads and the host operating system.

First boot

When macOS starts for the first time, Setup Assistant requires the creation of a primary account.

Set a long and unique password. Leave the password hint field blank.

Avoid personally identifiable names: the computer name (such as "John Appleseed's MacBook") is broadcast over local networks and visible to other devices.

The system name can be configured in System Settings > About or with the commands:

sudo scutil --set ComputerName MacBook
sudo scutil --set HostName MacBook
sudo scutil --set LocalHostName MacBook

Admin and user accounts

The first account created is an administrator account. Administrators can change system-wide settings and run commands with sudo, which temporarily grants elevated privileges. Any program the administrator runs could obtain the same access; sudo may also have vulnerabilities.

It is considered a best practice to use a dedicated standard account for regular, daily work and only use the administrator account for software and system installation, configuration and updates.

It is not required to ever log in with the admin account via the macOS login screen. When a Terminal command requires administrator privileges, the system will prompt for authentication and Terminal continues using those privileges. To that end, Apple provides recommendations for hiding the admin account and its home directory.

Caveats

  • Only administrators can install applications in the system-wide /Applications directory. Finder and Installer ask a standard user to enter an administrator's credentials when approval is required. Some applications can instead be installed in ~/Applications; applications which do not require admin access should be installed in the user directory. App Store applications are still installed in /Applications and require no additional authentication.
  • A standard user usually is not authorized to use sudo. When administrator privileges are required, macOS prompts for an administrator's credentials, or the task can be run from an administrator account.
  • System Settings and several system utilities (e.g., Wi-Fi Diagnostics) require administrator permission for full functionality. Some System Settings need to be unlocked by selecting the lock icon. Some applications will simply prompt for authentication upon opening, others must be opened by an admin account directly to access all functions (e.g., Console).
  • Some third-party applications assume the current user is an administrator and will not work from a standard account.
  • See issue 167 for additional considerations.

Setup

Accounts be created and managed in System Settings. On existing systems, it is generally easier to create a second admin account and then change the original account from an administrator account to a standard account. Newly-installed systems should instead add a standard account after setup.

Demoting an account can be done from the new admin account in System Settings.

See also this post for more information about how macOS determines group membership.

Firmware

Verify that firmware security is set to Full Security to prevent tampering with the system. This is the default setting.

FileVault

Apple silicon Macs use hardware-backed storage encryption by default. FileVault additionally requires an authorized user's password to unlock the startup volume after restart.

On Apple silicon, FileVault authorization also protects the firmware, which prevents booting from anything other than the designated startup disk, accessing Recovery, and reviving it with device firmware update (DFU) mode.

FileVault will prompt to set a recovery key, which should be stored in a safe location if used. FileVault also offers an option to use iCloud for recovery.

Confirm FileVault state:

fdesetup status

Lockdown Mode

Lockdown Mode significantly reduces attack surface by disabling system and application features commonly exploited in sophisticated attacks.

When Lockdown Mode is enabled, Safari has an option to exclude trusted websites from restrictions.

Firewall

There are several types of firewalls available for macOS.

Note

If malware gains administrator control, it may disable or bypass firewall policies; do not rely on a local firewall as strong protection against a full system compromise.

Application layer firewall

The built-in firewall provides basic protection and blocks incoming connections only. It can neither monitor nor block outgoing connections.

It can be controlled by the Firewall tab of Network in System Settings, or with the following commands.

Attackers frequently scan networks to identify systems to target. When stealth mode is enabled, responses are not sent to connection attempts from closed ports, making the system more difficult to detect.

Stealth mode

Enable the firewall and stealth mode:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on

Signed apps

By default, the firewall allows incoming connections for software signed by Apple or by an identified developer. Disabling these rules makes macOS ask before allowing an application to accept incoming connections:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsigned off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsignedapp off

Reload firewall

After changing settings with socketfilterfw, reload the firewall service to apply the new configuration:

sudo pkill -HUP socketfilterfw

Get state

Confirm firewall state:

for firewallFlag in \
  --getglobalstate \
  --getblockall \
  --getallowsigned \
  --getstealthmode \
  --listapps
do /usr/libexec/ApplicationFirewall/socketfilterfw "$firewallFlag"
done

AirDrop

Enabling the application layer firewall and disabling incoming connections for built-in software prevents AirDrop from functioning correctly. For AirDrop to work, both sharingd and rapportd require firewall exceptions:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/sharingd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/libexec/sharingd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/rapportd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/libexec/rapportd

Third-party firewalls

Applications such as Little Snitch, Radio Silence, and LuLu provide a balance between usability and security.

These programs are capable of monitoring and blocking both incoming and outgoing connections. However, they may require a closed-source system extension.

If frequent allow-or-block prompts are overwhelming, temporarily allow connections while also recording them (Silent Allow mode in Little Snitch). Review the configuration to understand and control network activity.

Packet filter

macOS also includes pf, a packet-filtering firewall configured from the command line. It is powerful but considerably more complex than the built-in application firewall.

pf can also be controlled with a graphical application such as Murus.

Many books and guides cover the pf firewall. The following example shows how to configure a basic policy.

Example pf config

Add the following rules to a file named pf.rules:

# Define interface
wifi = "en0"

# Global options
set block-policy drop
set skip on lo0
set state-policy if-bound
set ruleset-optimization basic
scrub in on $wifi all fragment reassemble

# Define tables
table <blocklist> persist

# Default deny both directions and log
block log all
block quick from no-route to any
antispoof quick for $wifi

# Blocklist enforcement
block log quick on $wifi from { <blocklist> } to any
block log quick on $wifi from any to { <blocklist> }

# DHCP
pass out on $wifi proto udp from any port 68 to any port 67 keep state
pass in  on $wifi proto udp from any port 67 to any port 68 keep state

# Outbound TCP
pass out on $wifi proto tcp from ($wifi) to any flags S/SA keep state

# Outbound UDP
pass out on $wifi proto udp from ($wifi) to any keep state

# Outbound ICMP (ping)
pass out on $wifi proto icmp from ($wifi) to any keep state

Firewall commands

To control the firewall:

Command Task
sudo pfctl -e -f pf.rules enable firewall with configuration file
sudo pfctl -t blocklist -T add 1.2.3.4 add an address to the blocklist
sudo pfctl -d disable firewall

To monitor the firewall:

Command Task
sudo pfctl -t blocklist -T show show blocklist
sudo pfctl -sr show active rules
sudo pfctl -ss show state table
sudo ifconfig pflog0 create create packet log interface
sudo tcpdump -ni pflog0 monitor blocked packets

Block networks

pf can block ranges of network addresses, for example to an entire organization. Query Merit RADb for the list of networks in use by an autonomous system (a large network operated by a single organization), such as Facebook:

whois -h whois.radb.net '!gAS32934'

Copy and paste the list of networks returned into the blocklist command:

sudo pfctl -t blocklist -T add 31.13.24.0/21 31.13.64.0/24 157.240.0.0/16

Confirm the addresses were added:

$ sudo pfctl -t blocklist -T show
No ALTQ support in kernel
ALTQ related functions disabled
   31.13.24.0/21
   31.13.64.0/24
   157.240.0.0/16

Confirm network traffic is blocked to those addresses (DNS requests will still work):

$ dig a +short facebook.com
157.240.2.35

$ curl --connect-timeout 5 -I https://facebook.com/
*   Trying 157.240.2.35...
* TCP_NODELAY set
* Connection timed out after 5002 milliseconds
* Closing connection 0
curl: (28) Connection timed out after 5002 milliseconds

$ sudo tcpdump -tqni pflog0 'host 157.240.2.35'
IP 192.168.1.1.62771 > 157.240.2.35.443: tcp 0
IP 192.168.1.1.62771 > 157.240.2.35.443: tcp 0
IP 192.168.1.1.62771 > 157.240.2.35.443: tcp 0

The firewall drops the initial packets needed to start the TCP connection, so the connection times out.

See drduh/config/scripts/pf-blocklist.sh for more inspiration.

Services

Many system and user background services are managed by launchd.

Administrator accounts can modify services and extensions in System Settings.

Command Task
launchctl list view user jobs
sudo launchctl list view system jobs
launchctl list com.apple.Finder examine a service
systemextensionsctl list list system extensions
ls /System/Library/LaunchDaemons list system daemons
ls /System/Library/LaunchAgents list system agents

To read a service configuration:

defaults read /System/Library/LaunchAgents/com.apple.Finder

Important

System services are protected by SIP; disabling SIP to modify system services can compromise security and cause system instability.

To view the status of services:

find /var/db/com.apple.xpc.launchd \
  -type f -print -exec defaults read {} \; 2>/dev/null

See script management with launchd and launchd.info for more information.

Siri Suggestions and Spotlight

Siri Suggestions and Spotlight may send some queries or usage information to Apple, depending on the enabled features. In System Settings, search for Siri and Spotlight, then disable online suggestions and configure categories to exclude from indexing or suggestion. Review Apple's Search & Privacy policy for more information.

Homebrew

If a program is not available through the App Store, consider using Homebrew.

Important

Some Homebrew installation or management workflows may prompt for App Management or Full Disk Access. Grant these permissions only when they are fully understood and necessary.

Periodically run brew upgrade on trusted and secure networks to install software updates. To get information on a package before installation, run brew info <package> and review its formula online. Enable additional security options, such as HOMEBREW_NO_INSECURE_REDIRECT=1

According to Homebrew's Anonymous Analytics, Homebrew collects anonymous usage analytics and reports them to a self-hosted InfluxDB instance.

To opt out of Homebrew analytics, run brew analytics off or set HOMEBREW_NO_ANALYTICS=1 in the shell startup file.

DNS

DNS profiles

macOS features "DNS configuration profiles" for configuring encrypted DNS, filtering, and DNSSEC.

DNS profiles can be created or obtained from providers such as Quad9, AdGuard and NextDNS.

Hosts file

Use the hosts file to block domains associated with malware, advertising, and other unwanted services.

To block a domain by A record, append any one of the following lines to /etc/hosts:

0 example.com
0.0.0.0 example.com
127.0.0.1 example.com

Note

IPv6 uses AAAA records rather than A records: block IPv6 connections by including ::1 example.com entries.

Many domain lists are available online. Before appending one to /etc/hosts, ensure each entry begins with 0, 0.0.0.0, or 127.0.0.1, and retain the 127.0.0.1 localhost entry.

Popular hosts lists include:

To download and append a list to the hosts file, use the tee command:

curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts |
  sudo tee -a /etc/hosts

Little Snitch also supports blocklists.

DNSCrypt

To encrypt DNS traffic, consider DNSCrypt/dnscrypt-proxy. When configured with a trusted resolver, DNSCrypt encrypts DNS queries. DNSSEC can additionally validate signed DNS responses where supported.

Install DNSCrypt from Homebrew and follow the instructions to configure and start dnscrypt-proxy:

brew install dnscrypt-proxy

When using DNSCrypt with Dnsmasq, locate the DNSCrypt configuration file by running:

brew info dnscrypt-proxy

This command should display a path such as /usr/local/etc/dnscrypt-proxy.toml.

By default, dnscrypt-proxy listens on 127.0.0.1:53 and sends queries to one or more configured DNS providers. Modify the configuration and change listen_addresses to use a port other than 53, such as 5355:

listen_addresses = ['127.0.0.1:5355', '[::1]:5355']

Start DNSCrypt:

sudo brew services restart dnscrypt-proxy

Confirm DNSCrypt is running:

$ sudo lsof +c 15 -Pni UDP:5355
COMMAND          PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
dnscrypt-proxy 15244 nobody    7u  IPv4 0x1337f85ff9f8beef      0t0  UDP 127.0.0.1:5355
dnscrypt-proxy 15244 nobody   10u  IPv6 0x1337f85ff9f8beef      0t0  UDP [::1]:5355
dnscrypt-proxy 15244 nobody   12u  IPv4 0x1337f85ff9f8beef      0t0  UDP 127.0.0.1:5355
dnscrypt-proxy 15244 nobody   14u  IPv6 0x1337f85ff9f8beef      0t0  UDP [::1]:5355

Additionally, these pf rules block conventional DNS traffic to port 53 outside the loopback interface, to reduce the risk of DNS leaks:

block drop quick on !lo0 proto udp from any to any port = 53
block drop quick on !lo0 proto tcp from any to any port = 53

Dnsmasq

dnsmasq can cache replies, prevent upstream queries for unqualified names, and block entire top-level domains.

Use it in combination with DNSCrypt to encrypt DNS traffic.

If you do not use DNSCrypt, at minimum choose a DNS resolver other than the one provided by the ISP. Two popular alternatives are Google DNS and OpenDNS.

Install Dnsmasq:

brew install dnsmasq

Download and edit drduh/config/dnsmasq.conf or the default configuration file.

See drduh/config/domains for example domain lists that can be added to block specific destinations.

Install and start the program (sudo is required to bind to privileged port 53):

sudo brew services start dnsmasq

To set dnsmasq as the local DNS server, open System Settings > Network and select the network connection currently in use (such as Wi-Fi), then open the DNS tab, select +, and add 127.0.0.1, or use:

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1

Confirm Dnsmasq is configured:

$ scutil --dns | head
DNS configuration

resolver #1
  search domain[0] : whatever
  nameserver[0] : 127.0.0.1
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

$ networksetup -getdnsservers "Wi-Fi"
127.0.0.1

Note

Some VPN applications override DNS settings on connect. See issue 24 and drduh/config/scripts/macos-dns.sh.

Certificate authorities

macOS includes a set of trusted root certificate authorities (CAs) operated by corporations, governments and other organizations from around the world. A trusted CA can issue certificates that macOS and browsers may accept for HTTPS connections, making the root CA store a critical part of the system's trust boundary.

Inspect System Roots to understand the Apple-provided trusted root store using Keychain Access or the security command-line tool and /System/Library/Keychains/SystemRootCertificates.keychain file. Keychain Access can also be launched with the command:

open "/System/Library/CoreServices/Applications/Keychain Access.app"

Also review any certificates that may have been added by a user, administrator, VPN client, security product, or mobile device management application in the login, Local Items, and System keychains.

To disable a selected certificate, modify its Trust setting to Never Trust and close the window to confirm. Doing so may reduce the risk of MITM attacks, in which a fraudulent certificate is used to silently intercept encrypted traffic.

Warning

Removing or modifying certificate authority trust settings can break websites, software updates, enterprise networks, VPNs, captive portals, and other services.

See Apple's available trusted certificates and blocked certificates lists for current trust-store information.

Privoxy

Consider using Privoxy as a local proxy to filter web traffic.

Install and start Privoxy using Homebrew:

brew install privoxy
brew services start privoxy

Alternatively, a signed installation package for Privoxy is available from their website or Sourceforge. The signed package is more secure than the Homebrew version and receives support from the Privoxy project.

By default, Privoxy listens on local TCP port 8118.

Set the system HTTP proxy for the active network interface to 127.0.0.1 and port 8118:

sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 8118

Set the system HTTPS proxy:

sudo networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 8118

The proxy can also be set in System Settings > Network > Details > Proxies.

Confirm the proxy is set:

$ scutil --proxy
<dictionary> {
  ExceptionsList : <array> {
    0 : *.local
    1 : 169.254/16
  }
  FTPPassive : 1
  HTTPEnable : 1
  HTTPPort : 8118
  HTTPProxy : 127.0.0.1
}

Although most web traffic is encrypted, Privoxy can filter requests by hostname. For example, the following rules block all traffic except traffic to .net, github.com, and Apple domains:

{ +block{all} }
.

{ -block }
.apple.
.github.com
.net

To block Facebook domains:

{ +block{facebook} }
.cdninstagram.
.facebook*.
.fb.
.fbcdn*.
.fbinfra.
.fbsbx.
.fbstatic*.
.fbsv.
.fburl.
.instagr.am
.tfbnw.
.thefacebook.
fb*.akamaihd.net

See drduh/config/privoxy/config and drduh/config/privoxy/user.action for additional Privoxy examples. Privoxy does not need to be restarted after editing filter rules.

To verify traffic is blocked or redirected, use curl or open the Privoxy interface at http://p.p in a browser:

$ ALL_PROXY=127.0.0.1:8118 curl example.com -IL | head
HTTP/1.1 403 Request blocked by Privoxy
Content-Length: 9001
Content-Type: text/html
Cache-Control: no-cache
Pragma: no-cache

$ ALL_PROXY=127.0.0.1:8118 curl github.com -IL | head
HTTP/1.1 302 Local Redirect from Privoxy
Location: https://github.com/
Content-Length: 0

HTTP/1.1 200 Connection established

HTTP/2 200
content-type: text/html; charset=utf-8

Note

Applications and services can ignore the proxy settings. pf can redirect traffic through a proxy without configuring each application separately.

Browser

Web browsers create significant security and privacy risks because they download and execute untrusted Internet content.

A key browser security boundary is the same-origin policy (SOP), which prevents one website from reading another website's data. A bypass can expose data or actions from other sites in the same browser profile.

Some browser attacks rely on convincing the user to install software, grant permissions, or use a malicious extension. Be especially careful with unexpected downloads, extension prompts, and requests to run commands in Terminal.

Browser extensions also pose a significant security risk: a malicious or poorly-made extension can compromise everything in the browser, including credentials. The use of browser extensions should be limited to critically necessary ones, published by trustworthy developers only.

Use separate browser profiles for different identities and purposes. If practical, disable JavaScript and only allow it on trusted sites using browser site permissions.

Mozilla Firefox, Google Chrome, Safari, and Tor Browser are popular browsers, each with unique features and individual purposes.

Firefox

Firefox modernized major parts of its codebase through the Quantum and Photon projects. Quantum includes moving some components from C++ to Rust, a programming language designed to improve memory safety and concurrency safety.

Firefox offers a comparable security model to Chrome, including a bug bounty program for responsible disclosure of vulnerabilities. Firefox follows a four-week release cycle.

See drduh/config/firefox.user.js and arkenfox/user.js for recommended configurations. Also see NoScript, an extension which allows selective script blocking.

Firefox focuses on user privacy. It supports tracking protection in Private Browsing mode. The tracking protection can be enabled for the default account, although it may break the browsing experience on some websites. Firefox in Strict tracking protection mode will randomize fingerprints to defend against tracking. Firefox offers separate user profiles. Browsing can also be delineated with Multi-Account Containers.

Firefox only supports Web Extensions through the WebExtension API, which is very similar to Chrome. Submission of Web Extensions in Firefox is free. Web Extensions in Firefox most of the time are open-source, although certain Web Extensions are proprietary.

Chrome

Google Chrome is based on the open-source Chromium project. Chrome includes some proprietary components, automatic updates, a PDF viewer, media-codec support, crash reporting, and Google account integration. Review Chrome privacy settings and Google privacy policies for more information.

Chrome offers account sync between multiple devices, including credentials; the data is encrypted with the account password.

Chrome has the largest share of global usage and is the preferred target platform for the majority of developers. Major technologies are based on Chrome's open-source components, such as node.js which uses Chrome's V8 Engine and the Electron framework, which is based on Chromium and node.js. Chrome's vast user base makes it the most attractive target for threat actors and security researchers. Despite constant attacks, Chrome has retained an impressive security track record over the years. This is not a small feat.

Chrome offers separate profiles, robust sandboxing, frequent updates, and carries impressive credentials. In addition, Google offers a very lucrative bounty program for reporting vulnerabilities, along with its own Project Zero team. This means that a large number of highly talented and motivated people are constantly auditing and securing Chrome code.

Consider disabling V8 optimization (JavaScript-engine performance features) in browser settings - see this explanation for the security trade-offs.

Block trackers with uBlock Origin Lite.

Disable DNS prefetching (see DNS Prefetching and Its Privacy Implications). Chrome may attempt to resolve DNS using Google's 8.8.8.8 and 8.8.4.4 public nameservers.

See Chromium Security and Chromium Privacy for more information. Read Google's privacy policy to understand how personal information is collected and used.

Safari

Safari is Apple's built-in browser and is integrated with macOS, providing battery efficiency improvements on Apple hardware.

Safari has both open-source and proprietary components. Safari is based on the open-source Web Engine WebKit, which is ubiquitous among the macOS ecosystem. WebKit is used by Apple apps such as Mail, Books, and the App Store. Chrome's Blink engine is a fork of WebKit and both engines share a number of similarities.

Safari supports certain unique features that benefit user security and privacy. Content blockers enable the creation of content blocking rules without using JavaScript. This rule based approach greatly improves memory use, security, and privacy. Safari 11 introduced Intelligent Tracking Prevention, which removes tracking data stored in Safari after a period of non-interaction by the user from the tracker's website. Safari can randomize the browser fingerprint to reduce tracking. Safari does not support certain features such as WebUSB or the Battery API intentionally for security and privacy reasons. Private tabs in Safari have isolated cookies and cache that is destroyed when you close the tab. Safari also support Profiles which are equivalent to Firefox's Multi-Account Containers for separating cookies and browsing. Safari can be made significantly more secure with lockdown mode, which can be disabled per-site. Read more about tracking prevention in Safari.

Web Extensions in Safari have an additional option to use native code in Safari's sandbox environment, in addition to Web Extension APIs. Web Extensions in Safari are also distributed through Apple App Store. App Store submission comes with the added benefit of Web Extension code being audited by Apple. On the other hand App Store submission comes at a steep cost. Yearly developer subscription fee costs 100 USD (in contrast to Chrome's 5 USD fee and Firefox's free submission). The high cost is prohibitive for the majority of open-source developers. As a result, Safari has very few extensions to choose from. However, keep the high cost in mind when installing extensions. It is expected that most Web Extensions will have some way of monetizing usage to cover development costs. Avoid Web Extensions without open-source code available for review.

Safari syncs user preferences and passwords with iCloud Keychain. Viewing a saved password requires authentication with the current device account password or another configured authentication method.

Safari implements new web features more slowly than Chrome or Firefox, but security patches are delivered promptly through system updates.

See also el1t/uBlock-Safari to disable hyperlink auditing beacons.

Web browser privacy

Websites infer information about the browser and device from settings, fonts, screen size, language, IP address, and browser behavior. This information contributes to browser fingerprinting.

For more information about security-conscious browsing and what data is sent by the browser, see HowTo: Privacy & Security Conscious Browsing, browserleaks.com, Am I Unique? and EFF Cover Your Tracks resources.

To reduce cross-site tracking, block third-party cookies.

Also be aware of WebRTC, which may reveal local or public (if connected to a VPN) IP address(es). In Firefox and Chrome/Chromium, this feature can be disabled with uBlock Origin. Lockdown mode also disables WebRTC in Safari.

Tor

Tor is an anonymity network that can provide additional privacy while browsing. Tor Browser is a modified Firefox-based browser configured to use the Tor network.

Download Tor Browser from Tor Project, both dmg and asc files for verification:

$ cd ~/Downloads

$ file tor-browser-macos-*
tor-browser-macos-15.0.17.dmg:     XZ compressed data, checksum NONE
tor-browser-macos-15.0.17.dmg.asc: PGP signature Signature (old)

$ gpg --verify tor-browser-macos-*.asc
[...]
gpg: Can't check signature: No public key

$ gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org
gpg: key 0x4E2C6E8793298290: public key "Tor Browser Developers (signing key) <torbrowser@torproject.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1
pub   rsa4096/0x4E2C6E8793298290 2014-12-15 [C] [expires: 2027-07-15]
      Key fingerprint = EF6E 286D DA85 EA2A 4BA7  DE68 4E2C 6E87 9329 8290
uid                   [ unknown] Tor Browser Developers (signing key) <torbrowser@torproject.org>
sub   rsa4096/0x157432CF78A65729 2024-07-15 [S] [expires: 2026-10-26]
      Key fingerprint = CAAE 408A EBE2 288E 96FC  5D5E 1574 32CF 78A6 5729

$ gpg --verify tor-browser-macos-*.asc
gpg: assuming signed data in 'tor-browser-macos-15.0.17.dmg'
gpg: Signature made Sun Jun 28 15:35:20 2026 PDT
gpg:                using RSA key CAAE408AEBE2288E96FC5D5E157432CF78A65729
gpg: Good signature from "Tor Browser Developers (signing key) <torbrowser@torproject.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: EF6E 286D DA85 EA2A 4BA7  DE68 4E2C 6E87 9329 8290
     Subkey fingerprint: CAAE 408A EBE2 288E 96FC  5D5E 1574 32CF 78A6 5729

Make sure Good signature from "Tor Browser Developers (signing key) <torbrowser@torproject.org>" appears in the output. The warning is expected, as the key has not been personally verified and added to a trusted keyring.

See How can I verify Tor Browser's signature? for more information.

To finish installing Tor Browser, open the disk image and drag it to the Applications folder, or use the commands:

hdiutil mount tor-browser-macos-15.0.17.dmg
cp -r /Volumes/Tor\ Browser/Tor\ Browser.app/ ~/Applications/

Verify the application was signed by The Tor Project's Apple Developer ID MADPSAYN6T using the spctl -a -v or pkgutil --check-signature commands:

$ spctl -a -vv ~/Applications/Tor\ Browser.app
/Users/user1/Applications/Tor Browser.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)

$ pkgutil --check-signature ~/Applications/Tor\ Browser.app
Package "Tor Browser.app":
   Status: signed by a certificate trusted by macOS
   Certificate Chain:
    1. Developer ID Application: The Tor Project, Inc (MADPSAYN6T)
       Expires: 2028-10-11 17:57:46 +0000
       SHA256 Fingerprint:
           76 3C 89 02 ED CB AD 8E 59 86 1E 93 D3 05 5B 28 F9 04 0C 96 03 8B
           16 28 9F 38 64 ED 53 45 B4 DA
       ------------------------------------------------------------------------
    2. Developer ID Certification Authority
       Expires: 2031-09-17 00:00:00 +0000
       SHA256 Fingerprint:
           F1 6C D3 C5 4C 7F 83 CE A4 BF 1A 3E 6A 08 19 C8 AA A8 E4 A1 52 8F
           D1 44 71 5F 35 06 43 D2 DF 3A
       ------------------------------------------------------------------------
    3. Apple Root CA
       Expires: 2035-02-09 21:40:36 +0000
       SHA256 Fingerprint:
           B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C
           68 C5 BE 91 B5 A1 10 01 F0 24

The command codesign can also be used to examine an application's code signature:

$ codesign -dvv ~/Applications/Tor\ Browser.app
Executable=/Users/user1/Applications/Tor Browser.app/Contents/MacOS/firefox
Identifier=org.torproject.torbrowser
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=805 flags=0x10000(runtime) hashes=14+7 location=embedded
Signature size=9054
Authority=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Jun 28, 2026 at 14:01:57
Notarization Ticket=stapled
Info.plist entries=27
TeamIdentifier=MADPSAYN6T
Runtime Version=15.5.0
Sealed Resources version=2 rules=13 files=208
Internal requirements count=1 size=188

To view full certificate details for a signed application, extract with codesign and decode with openssl:

$ codesign -d --extract-certificates ~/Applications/Tor\ Browser.app
Executable=/Users/user1/Applications/Tor Browser.app/Contents/MacOS/firefox

$ file codesign*
codesign0: Certificate, Version=3
codesign1: Certificate, Version=3
codesign2: Certificate, Version=3 Certificate, Version=02

$ openssl x509 -inform der -in codesign0 -subject -issuer -startdate -enddate -noout
subject= /UID=MADPSAYN6T/CN=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)/OU=MADPSAYN6T/O=The Tor Project, Inc/C=US
issuer= /CN=Developer ID Certification Authority/OU=G2/O=Apple Inc./C=US
notBefore=Oct 11 17:57:47 2023 GMT
notAfter=Oct 11 17:57:46 2028 GMT

$ openssl x509 -inform der -in codesign0 -fingerprint -noout
SHA256 Fingerprint=76:3C:89:02:ED:CB:AD:8E:59:86:1E:93:D3:05:5B:28:F9:04:0C:96:03:8B:16:28:9F:38:64:ED:53:45:B4:DA

Tor Browser can use special connection methods called pluggable transports to make traffic harder to identify or block. This can be done by setting up a relay or using an existing bridge.

The Tor network provides anonymity, which is not necessarily the same as privacy. The network does not defend against a global observer capable of traffic analysis and correlation. See also Seeking Anonymity in an Internet Panopticon and Traffic Correlation on Tor by Realistic Adversaries.

See Tor Protocol Specification for more information.

Also see Invisible Internet Project (I2P) and its Tor comparison.

VPN

Choose a VPN provider or self-hosted setup with a documented, modern protocol and well-audited clients. Avoid obsolete protocols such as PPTP in favor of OpenVPN or WireGuard on a Linux VM or via a set of cross platform tools.

Some VPN clients may send traffic over the next available network interface when the connection is interrupted or disconnected. See scy/8122924 for an example on how to allow traffic only over VPN.

See guides to set up an IPsec VPN on a virtual machine (hwdsl2/setup-ipsec-vpn) or a Docker container (hwdsl2/docker-ipsec-vpn-server).

It may be worthwhile to consider the geographical location of the VPN provider. See further discussion in issue 114.

Also see this technical overview of the macOS built-in VPN L2TP/IPsec and IKEv2 client.

PGP/GPG

PGP is a standard for encrypting and signing data, especially email. It can protect message content between correspondents who correctly exchange and verify keys, but it does not protect metadata such as email recipients and subject lines.

GPG (GNU Privacy Guard) is a GPL-licensed, open-source program compliant with the PGP standard. It can verify software signatures and encrypt files symmetrically or using public keys.

Install GnuPG with Homebrew (brew install gnupg) or install GPG Suite.

Download gpg.conf to use recommended settings:

curl -o ~/.gnupg/gpg.conf \
  https://raw.githubusercontent.com/drduh/YubiKey-Guide/main/config/gpg.conf

See drduh/YubiKey-Guide to generate and manage credentials.

Email

Email is not designed to provide strong privacy by default: message content may be retained by service providers, copied to recipients' mailboxes, forwarded, or exposed through account compromise. Metadata (including recipient, subject, timestamps, and mail server information) generally remains visible even when message content is encrypted.

Thunderbird

Thunderbird is a free and open-source email client with standard IMAP, POP, CalDAV, and CardDAV support. It is a suitable choice for accessing mail and retaining local copies rather than depending exclusively on a provider's remote server.

Thunderbird includes support for OpenPGP email encryption, which can protect message content and provide cryptographic signatures. Always verify public-key fingerprints through an independent channel before relying on a key for sensitive communication.

The archived messages feature can move messages out of remote mail servers to a Local Folder, improving privacy.

Messengers

XMPP

XMPP is an open protocol developed by the IETF that supports cross-platform, federated messaging. There are many client options. Consider using one of the browser-based clients to take advantage of the browser's sandbox.

Depending on the provider, you might not need anything other than a username and password to set up an account.

XMPP is not end-to-end encrypted (E2EE) by default; use OMEMO with a compatible client.

Signal

Signal is a popular E2EE messenger whose double-ratchet protocol is used by many other applications including WhatsApp, Google Messages, and Facebook Messenger.

To use the Signal desktop app, Signal must first be installed on a phone.

See EFF's Signal guide for additional guidance.

iMessage

iMessage is Apple's first-party messenger. It requires an Apple Account to use.

Enable Contact Key Verification and verify contacts.

iMessage can be used with either a phone number or an email.

Warning

By default, iCloud backup is enabled, which stores copies of message encryption keys on Apple's servers without E2EE. Either disable iCloud backup or enable Advanced Data Protection to prevent this. Remind messaging recipients to do the same.

Viruses and malware

See Methods of malware persistence on Mac OS X and Malware Persistence on OS X Yosemite to learn how common macOS malware persists.

For examples of advanced macOS malware capabilities, see the Hacking Team material. For further analysis, see root installation for MacOS, support driver for Mac Agent and RCS Agent for Mac.

Also see A Brief Analysis of an RCS Implant Installer and reverse.put.as.

Downloading Software

Applications from the App Store or notarized by Apple may reduce malware risk, but neither process guarantees safety. Apple performs automated checks on notarized apps, and App Store apps undergo review. Otherwise, obtain software from sources identified by the developer as official, and verify the website or command-line download uses HTTPS.

App Sandbox

Check if a program uses App Sandbox:

codesign -dvvv --entitlements - /path/to/application.app

With App Sandbox enabled, output will include:

[Key] com.apple.security.app-sandbox
[Value]
    [Bool] true

Activity Monitor can also indicate whether it is enabled with the "Sandbox" column displayed:

defaults write com.apple.ActivityMonitor "UserColumnsPerTab v6.0" \
  -dict-add 0 '(Command, CPUUsage, CPUTime, Threads, IdleWakeUps, Architecture, GPUUsage, GPUTime, PID, UID, Sandbox, restricted)'

App Store software is required to use App Sandbox. Applications such as Google Chrome use their own sandbox and might not use App Sandbox.

Note

Sandboxing limits an application's default access, but entitlements and user-granted permissions can expand access.

Hardened Runtime

Check if a program uses the Hardened Runtime before running it using the command:

codesign --display --verbose /path/to/application.app

If Hardened Runtime is enabled, flags=0x10000(runtime) will appear in output.

Activity Monitor has the option to display a "Restricted" column which indicates a program is restricted from injecting code via macOS's dynamic linker.

The Hardened Runtime is a prerequisite for notarization of distributed apps.

Antivirus

To scan files and applications, consider uploading them to VirusTotal, keeping in mind this makes them publicly-viewable.

macOS includes built-in antivirus software called XProtect, which runs in the background and updates signatures used to detect malware automatically. If malware is detected, XProtect attempts to remove and quarantine it.

Applications such as BlockBlock or hazcod/maclaunch might help prevent or detect persistent malware.

Antivirus software can help detect common malware, but it may also increase attack surface because it often runs with extensive system privileges. Some products may also send telemetry or samples to the vendor.

See Sophail: Applied attacks against Antivirus, Analysis and Exploitation of an ESET Vulnerability, Popular Security Software Came Under Relentless NSA and GCHQ Attacks, and How Israel Caught Russian Hackers Scouring the World for U.S. Secrets.

Gatekeeper

Gatekeeper verifies software notarization and provenance.

Gatekeeper warns when opening an application without notarization. It can be bypassed by selecting the application listed in System Settings > Privacy & Security after a failed attempt.

System Integrity Protection

To verify System Integrity Protection is enabled, use the command csrutil status, which should return: System Integrity Protection status: enabled. Otherwise, enable SIP using Recovery Mode.

Metadata and artifacts

macOS attaches metadata (APFS extended attributes) to files.

Metadata attributes can be viewed and removed with the mdls and xattr commands.

Other metadata and artifacts may be found in the directories including, but not limited to, ~/Library/Preferences/, ~/Library/Containers/<APP>/Data/Library/Preferences, /Library/Preferences, some of which is detailed below.

~/Library/Preferences/com.apple.sidebarlists.plist contains historical list of volumes attached. To clear it, use the command /usr/libexec/PlistBuddy -c "delete :systemitems:VolumesList" ~/Library/Preferences/com.apple.sidebarlists.plist

/Library/Preferences/com.apple.Bluetooth.plist contains Bluetooth metadata, including device history. If Bluetooth is not used, the metadata can be cleared with:

sudo defaults delete /Library/Preferences/com.apple.Bluetooth.plist DeviceCache
sudo defaults delete /Library/Preferences/com.apple.Bluetooth.plist IDSPairedDevices
sudo defaults delete /Library/Preferences/com.apple.Bluetooth.plist PANDevices
sudo defaults delete /Library/Preferences/com.apple.Bluetooth.plist PANInterfaces
sudo defaults delete /Library/Preferences/com.apple.Bluetooth.plist SCOAudioDevices

/var/spool/cups contains the CUPS printer job cache. To clear it, use the commands:

sudo rm -rfv /var/spool/cups/c0*
sudo rm -rfv /var/spool/cups/tmp/*
sudo rm -rfv /var/spool/cups/cache/job.cache*

To clear the list of iOS devices connected, use:

sudo defaults delete /Users/$USER/Library/Preferences/com.apple.iPod.plist "conn:128:Last Connect"
sudo defaults delete /Users/$USER/Library/Preferences/com.apple.iPod.plist Devices
sudo defaults delete /Library/Preferences/com.apple.iPod.plist "conn:128:Last Connect"
sudo defaults delete /Library/Preferences/com.apple.iPod.plist Devices
sudo rm -rfv /var/db/lockdown/*

Quicklook thumbnail data can be cleared using the qlmanage -r cache command, but this writes to the file resetreason in the Quicklook directories, and states that the Quicklook cache was manually cleared. Disable the thumbnail cache with qlmanage -r disablecache

It can also be cleared by getting the directory names with getconf DARWIN_USER_CACHE_DIR and sudo getconf DARWIN_USER_CACHE_DIR, then removing them:

rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/exclusive
rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite
rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite-shm
rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite-wal
rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/resetreason
rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/thumbnails.data

Similarly, for the root user:

sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/thumbnails.fraghandler
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/exclusive
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite-shm
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/index.sqlite-wal
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/resetreason
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/thumbnails.data
sudo rm -rfv $(getconf DARWIN_USER_CACHE_DIR)/com.apple.QuickLook.thumbnailcache/thumbnails.fraghandler

Also see 'quicklook' cache may leak encrypted data.

To clear Finder preferences:

defaults delete ~/Library/Preferences/com.apple.finder.plist FXDesktopVolumePositions
defaults delete ~/Library/Preferences/com.apple.finder.plist FXRecentFolders
defaults delete ~/Library/Preferences/com.apple.finder.plist RecentMoveAndCopyDestinations
defaults delete ~/Library/Preferences/com.apple.finder.plist RecentSearches
defaults delete ~/Library/Preferences/com.apple.finder.plist SGTRecentFileSearches

Additional diagnostic files may be found in the following directories - but caution should be taken before removing any, as it may break logging or cause other issues:

/var/db/CoreDuet/
/var/db/diagnostics/
/var/db/systemstats/
/var/db/uuidtext/
/var/log/DiagnosticMessages/

macOS may collect spelling and language suggestions. To list them and prevent them from being created again, use the commands:

ls ~/Library/LanguageModeling/ ~/Library/Spelling/ ~/Library/Suggestions/
chmod -R 000 ~/Library/LanguageModeling ~/Library/Spelling ~/Library/Suggestions
chflags -R uchg ~/Library/LanguageModeling ~/Library/Spelling ~/Library/Suggestions

QuickLook application support metadata can be cleared and locked with the commands:

rm -rfv "$HOME/Library/Application Support/Quick Look/*"
chmod -R 000 "$HOME/Library/Application Support/Quick Look"
chflags -R uchg "$HOME/Library/Application Support/Quick Look"

Warning

Clearing or locking this directory can break core macOS applications and prevent document-version recovery.

Document revision metadata can be cleared and disabled with the commands:

sudo rm -rfv /.DocumentRevisions-V100/*
sudo chmod -R 000 /.DocumentRevisions-V100
sudo chflags -R uchg /.DocumentRevisions-V100

Saved application state metadata can be listed and locked with the commands:

ls ~/Library/Saved\ Application\ State/*
ls ~/Library/Containers/<APPNAME>/Data/Library/Saved\ Application\ State
chmod -R 000 ~/Library/Saved\ Application\ State/
chmod -R 000 ~/Library/Containers/<APPNAME>/Data/Library/Saved\ Application\ State
chflags -R uchg ~/Library/Saved\ Application\ State/
chflags -R uchg ~/Library/Containers/<APPNAME>/Data/Library/Saved\ Application\ State

Autosave metadata can be listed and locked with the commands:

ls "$HOME/Library/Containers/<APP>/Data/Library/Autosave Information"
ls "$HOME/Library/Autosave Information"
chmod -R 000 "~/Library/Containers/<APP>/Data/Library/Autosave Information"
chmod -R 000 "~/Library/Autosave Information"
chflags -R uchg "~/Library/Containers/<APP>/Data/Library/Autosave Information"
chflags -R uchg "~/Library/Autosave Information"

The Siri analytics database, which is created even if the Siri launch agent is disabled, can be cleared and locked with the commands:

rm -rfv ~/Library/Assistant/SiriAnalytics.db
chmod -R 000 ~/Library/Assistant/SiriAnalytics.db
chflags -R uchg ~/Library/Assistant/SiriAnalytics.db

Media played in QuickTime Player can be found in:

~/Library/Containers/com.apple.QuickTimePlayerX/Data/Library/Preferences/com.apple.QuickTimePlayerX.plist

Additional metadata may exist in the following files:

~/Library/Containers/com.apple.appstore/Data/Library/Preferences/com.apple.commerce.knownclients.plist
~/Library/Preferences/com.apple.commerce.plist
~/Library/Preferences/com.apple.QuickTimePlayerX.plist

Authentication

The Passwords app creates secure credentials. It supports passkeys, which are credentials designed to resist phishing when used with compatible services.

KeePassXC is an open-source, cross-platform password manager to consider. It supports strong authentication with compatible hardware tokens and a browser extension for entering credentials automatically.

Memorable passwords can be created with Diceware.

Ensure online accounts have multi-factor authentication enabled. Prefer phishing-resistant authentication, such as hardware tokens or passkeys with supported services. Authenticator apps are preferable to SMS codes, but any MFA is better than password-only authentication.

YubiKey is a popular hardware authentication token. It can also store keys for encryption, signing and authentication tasks - see drduh/YubiKey-Guide.

GnuPG can also manage passwords and other encrypted files - see drduh/Purse and drduh/pwd.sh.

Backup

Encrypt files locally before backing them up to external media or online services.

Follow the 3-2-1 backup model: keep three copies of important data, store them on at least two different types of media, and keep at least one copy in a separate physical location.

Time Machine

Time Machine is the built-in tool for handling backups on macOS. Use an external drive or network storage to create encrypted backups.

GnuPG

GnuPG can be used with a password or public key, with the private key stored on YubiKey.

Compress and encrypt a directory using a password:

tar zcvf - ~/Downloads | gpg -c > ~/Downloads/backup-$(date +%F-%H%M).tar.gz.gpg

Decrypt and decompress the directory:

gpg -o ~/Downloads/decrypted-backup.tar.gz -d ~/Downloads/backup-*.tar.gz.gpg
tar zxvf ~/Downloads/decrypted-backup.tar.gz

Disk Utility

Encrypted volumes can be created using Disk Utility or hdiutil:

hdiutil create ~/Downloads/encrypted.dmg -encryption -size 50M -volname "secretStuff"
hdiutil mount ~/Downloads/encrypted.dmg
cp -v ~/Documents/passwords.txt /Volumes/secretStuff
hdiutil eject /Volumes/secretStuff

Other

Tresorit and restic may also be of interest.

Wi-Fi

Wi-Fi network names, called SSIDs, and device probe behavior can reveal information about nearby and previously-used networks. Hidden networks do not provide meaningful privacy and can cause devices to actively probe for them.

Set a private Wi-Fi address to reduce network tracking.

Set wireless network security to WPA3. Follow Apple guidance to set recommended settings for routers and access points.

SSH

For remote SSH connections, use a unique SSH key protected by a passphrase or a hardware token, verify server host keys, and avoid password-based authentication. See drduh/config/ssh_config for recommended client options.

An SSH tunnel can securely route traffic through another computer, similar to a VPN. To use Privoxy running on a remote host on port 8118:

ssh -C -L 5555:127.0.0.1:8118 you@remote-host.tld
sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 5555
sudo networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 5555

Or to use an SSH connection as a SOCKS proxy:

ssh -NCD 3000 you@remote-host.tld

By default, macOS does not have Remote Login (SSH server) enabled.

To enable SSH and allow incoming connections, use System Settings > General > Sharing or the command:

sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

Disable password authentication and consider further hardening the SSH server configuration. See drduh/config/sshd_config for recommended options.

Confirm the SSH server is running:

sudo lsof -Pni TCP:22

Physical access

Do not leave the computer unattended in unsafe locations. A skilled attacker with unsupervised physical access could install a hardware keylogger to record keystrokes, including passwords. Using a Mac with a built-in keyboard or a bluetooth keyboard makes this more difficult as many off-the-shelf versions of this attack are designed to be plugged in between a USB keyboard and the computer.

To reduce the consequences of theft while a Mac is in use, consider using buskill/buskill-app or Lennolium/swiftGuard.

Consider purchasing a privacy screen/filter for use in public.

Nail polish and tamper-evidence seals can be applied to components to detect tampering.

Monitoring

Logs

Monitor system logs with Console or the log stream command.

Print all system logs from the last 5 minutes in classic syslog format:

log show --last 5m --style syslog

Output as JSON array:

log show --last 5m --style json

Output newline-delimited JSON (one JSON object per line); required for jq:

log show --last 5m --style ndjson

Filter messages by subsystem, for example from com.apple.SoftwareUpdate:

log show --last 1h --style json \
  --predicate 'subsystem == "com.apple.SoftwareUpdate"'

Filter messages by content, for example containing failed:

log show --last 1h --predicate 'eventMessage CONTAINS "failed"'

Case-insensitive message filtering:

log show --last 1h --predicate 'eventMessage CONTAINS[c] "error"'

Count distinct error messages with jq:

log show --last 1h --style ndjson \
  --predicate 'eventMessage CONTAINS[c] "error"' |
  jq -r '.eventMessage' | sort | uniq -c | sort -nr | head -100

Export logs to an archive, which can be opened with Console:

log collect --last 1h --output ~/Downloads/logs-$(date +%F-%H%M).logarchive

DTrace

System Integrity Protection interferes with DTrace and must be partially disabled before use.

  • iosnoop monitors disk I/O
  • opensnoop monitors file opens
  • execsnoop monitors processes
  • errinfo monitors failed system calls
  • dtruss monitors all system calls

See man -k dtrace for more information.

Processes

List running processes with Activity Monitor or the ps command.

Network

List open network connections:

sudo lsof -Pni

List the contents of various network-related data structures:

sudo netstat -atln

Wireshark can be used from the command line with tshark.

Replace en0 with the active interface shown by networksetup -listallhardwareports.

Important

Capture traffic only on networks and systems you are authorized to monitor.

Monitor DNS:

/Applications/Wireshark.app/Contents/MacOS/tshark -i en0 \
  -Y "dns.flags.response == 1" -Tfields \
  -e frame.time_delta \
  -e dns.qry.name \
  -e dns.a \
  -Eseparator=,

Monitor HTTP:

/Applications/Wireshark.app/Contents/MacOS/tshark -i en0 \
  -Y "http.request or http.response" -Tfields \
  -e ip.dst \
  -e http.request.full_uri \
  -e http.request.method \
  -e http.response.code \
  -e http.response.phrase \
  -Eseparator=/s

Monitor x509/TLS certificates:

/Applications/Wireshark.app/Contents/MacOS/tshark -i en0 \
  -Y "ssl.handshake.certificate" -Tfields \
  -e ip.src \
  -e x509sat.uTF8String \
  -e x509sat.printableString \
  -e x509sat.universalString \
  -e x509sat.IA5String \
  -e x509sat.teletexString \
  -Eseparator=/s -Equote=d

Miscellaneous

Diagnostic data

Disable Diagnostics & Usage Data.

Disable crash reporter (the dialog which appears after an application crashes and prompts to report the problem to Apple):

defaults write com.apple.CrashReporter DialogType none

Media player

Use QuickTime Player, the built-in media application, for playing music and video files. It uses App Sandbox, Hardened Runtime, and benefits from the Signed System Volume as part of the base system.

File handlers

Manage default file handlers to reduce risk of opening certain file types.

Change the default app for script files so that opening them displays their contents instead of executing them.

In Finder, locate and select any .sh file, right-click on it and select Get Info or press Command + I. In the "Open with" section, select TextEdit from the dropdown menu. If it is not listed, select "Other..." and Applications > TextEdit.app. Select "Change All..." and confirm by selecting Continue.

Screensaver

Set the screen to lock as soon as the screensaver starts:

defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0

Finder options

Show hidden files and the Library folder in Finder:

defaults write com.apple.finder AppleShowAllFiles -bool true
chflags nohidden ~/Library

Show all filename extensions:

defaults write NSGlobalDomain AppleShowAllExtensions -bool true

Do not default to saving documents to iCloud:

defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

umask

Set a custom umask:

sudo launchctl config user umask 077

Reboot, then create a file/directory and verify permissions (macOS default allows 'group/other' read access):

$ ls -ld umask*
drwx------@ 2 user1 staff  64 Jul 26 12:00 umask.dir
-rw-------@ 1 user1 staff  32 Jul 26 12:00 umask.txt

Keyboard entry

Enable secure keyboard entry in Terminal (this may interfere with applications such as TextExpander).

Networking

Disable Bonjour multicast advertisements (this also disables AirPlay and AirPrint features):

sudo defaults write /Library/Preferences/com.apple.mDNSResponder \
  NoMulticastAdvertisements -bool YES

Disable Handoff and Bluetooth features.

Sudoers

macOS comes with this line in /etc/sudoers:

Defaults env_keep += "HOME MAIL"

This prevents sudo from changing HOME when privileges are elevated. As a result, programs run with sudo may use configuration files from the invoking user's home directory. Consider removing HOME from env_keep unless this behavior is specifically required.

To retain the convenience of the root user having a non-root user's home directory, append an export line to /var/root/.zshrc, e.g.:

export HOME=/Users/user1

Related software

Software Category Description
lynis Audit scanner Cross-platform security-auditing tool that checks system configuration and suggests hardening improvements.
zentral Monitoring & configuration platform Fleet-management server for macOS endpoints; collects inventory, events, audits, and osquery results. Best suited to managed environments.
osquery Monitoring engine Exposes operating-system state as SQL tables, enabling repeatable checks of processes, users, launch items, network connections, and more.
pareto-mac Audit scanner Menu-bar application that checks a Mac against common baseline security recommendations.

Additional resources

Sponsor this project

Used by

Contributors