Detections · Harmful behavior
Download and execute on a Mac: when a server decides what runs
Many Mac threats are only a small loader. The file you received does little by itself: it fetches the real program from a server and runs it. That means what finally executes on your Mac is chosen by whoever controls the server, and can change from one day to the next without the file changing at all.
Updated November 25, 2026 · 79 detections in this category
In short
Code fetched from the network and run here: what executes is decided by a server, not by the file that was checked.
MacVigil has 79 detections in this category. It reads the file to find them and never runs it.
What download and execute is
A download-and-execute step joins two harmless actions, fetching data and running a program, so that the data becomes the program. The attacker gains flexibility: the first file can stay small and look innocent, while the payload behind it is swapped, updated or tailored to each victim. Fake installers and pasted Terminal commands from fake “fix” or “verify” pages very often work this way.
How Mac malware does it
- A single line such as
curl … | bash, or output piped intozsh,python3,perl,rubyorosascript, so the code never touches the disk. - Download to a file,
chmod +x, then launch it, sometimes after removing the quarantine mark withxattr -d com.apple.quarantineso the macOS check on downloads is skipped. - An archive downloaded, extracted, and a file inside it launched.
- Compiled programs that read bytes from a connection, write them to a path and start that same path, or map them into memory and jump to them.
- Script languages that pass a server response to
eval,execor a shell: JavaScript, Python, Perl, AppleScript and JavaScript for Automation. - Payloads staged in
/tmp, sometimes split across DNS TXT records, decoded from Base64 and then run. - Repeat delivery: a startup service or a
crontable that downloads and runs code again on every boot or on a schedule. - Less obvious carriers: a browser extension that runs code a server sends into every page, a PDF that launches an attached program, an
applescript:link that opens Script Editor with a program already filled in, a calendar entry holding a command line.
What MacVigil looks for
MacVigil reads the file and never runs it, so it cannot see the payload a server would send. What it can prove is the path: that the bytes received from the network are the same bytes written to a file, and that this same file, unmodified, is the one made executable and launched, or that a response is handed straight to an interpreter with no file in between.
A single ingredient is not treated as proof. Mentions of a download tool, of Base64 decoding or of quarantine removal are recorded as clues, and when the pieces are only separate mentions, MacVigil says so and does not claim they ran. Some of the strongest combinations also require that no accountable publisher stands behind the program.
When it is normal
Installation bootstrap scripts, maintenance and deployment tools, updaters and plug-in systems all fetch code and run it. Developers paste curl … | sh lines to install well-known tools every day. The questions are where the code comes from, whether the connection is checked, who signed the program, and whether the step hides itself.
How to check your Mac
- Never paste a command into Terminal because a web page, a chat message or a fake error told you to.
- Look at your Terminal history with
open -e ~/.zsh_historyforcurlorosascriptlines you do not remember running. - Check whether a downloaded file still carries its quarantine mark with
xattr -p com.apple.quarantine /path/to/file. - Look in
/tmp,~/Library/LaunchAgentsand withcrontab -lfor anything that fetches from the network. - Before opening an installer, check its signature with
codesign -dv --verbose=4orpkgutil --check-signature.
Related categories
- Remote control: What lets someone drive this Mac from a distance: a channel that receives commands, and the means to run them.
- Persistence: How a program arranges to start again on its own: launch agents and daemons, login items, scheduled jobs.
- Hidden payload: A second program carried out of sight: encoded, encrypted, appended after the file's end or tucked into resources.
- Runtime code loading: Code the program loads or makes while it runs: libraries opened by name, functions looked up with dlsym, memory made executable, program images built from a buffer. Browsers, plug-in hosts and JIT engines all do this.
On the blog
- A website asked you to paste a command in Terminal?
- AMOS in November 2026: the script is no longer in the file
- How to check a DMG or PKG for malware before you open it
Know what a file does before you open it
MacVigil reads any app, disk image, installer or script without running it, and shows the evidence behind every finding. Nothing leaves your Mac.
Free for 7 days, then $29.95 a year for 2 Macs, a launch price: the regular price will be $59 a year. Requires macOS 15 Sequoia or later on a Mac with Apple silicon.
More: all detection categories · what MacVigil detects · the blog