
Terminal and script protections
Overview
As anti-malware protections on macOS become more effective, threat actors have increasingly turned to new techniques, including social engineering—persuading users to copy and paste malicious commands into a terminal, or to download and execute malicious scripts. On a Mac with macOS 26.4 or later, a set of three security enhancements were designed to address such threats. While each operates independently, together they form a layered defense against common social engineering campaigns and attacks targeting command-line execution.
Terminal paste protection
Terminal paste protection helps protect users from social engineering attacks that instruct them to copy and paste malicious commands into Terminal. A warning prompt appears when a user pastes text into the Terminal app from a common attack vector application—such as web browsers, messaging apps, and other common communication software. This warning is shown regardless of the contents of the paste being copied.
This warning is designed to help users who don’t routinely interact with the Terminal app. The warning is shown only when all of the following conditions are met:
The user hasn’t opened the Terminal app in more than 30 days.
No common developer tooling is detected on the system, such as Xcode and other common third-party IDEs.
The paste originates from a specific app, including popular web browsers, Messages, Mail, Preview, and common third-party messaging apps.
When these conditions are met and the user pastes content into the Terminal app, a dialog explains the potential risk and asks the user to confirm before the pasted text is executed.
Note: A 24-hour grace period after the initial system setup allows users to configure their systems without encountering the prompt. System software updates don’t reset this grace period.
Pasteboard command blocking
Pasteboard command blocking is designed to help prevent malware delivered through pasted terminal commands. When a user pastes text into any terminal emulator—including third-party terminal applications—XProtect traces the resulting process tree and inspects its behavior. Network artifacts associated with pasted commands are checked against Apple’s Safe Browsing Service. If a known malicious source is detected, the process is blocked and the user is notified. XProtect also evaluates behavioral patterns across the process tree, and can block activity consistent with known malware techniques.
AppleScript scanning
AppleScript scanning for AppleScript and JavaScript for Automation (JXA) scripts uses XProtect technology. Because the scanning is integrated into the OpenScripting framework, all AppleScript executions on macOS are subject to local inspection, whether the script is loaded from storage or from memory.
When a script matches a known malicious signature, macOS blocks execution and presents the user with a notification. If the blocked script is associated with a file stored on one of the following, the user can choose to override the block through the existing malware protection override in Finder:
Internal storage
External device
Cloud-based service
Mounted file server
Scripts executed without an associated file—such as those run directly from memory—can’t be overridden. The user needs to save the script first before requesting an override.