# caffeinate

> Prevent the system from sleeping on behalf of a utility.

caffeinate creates assertions to alter system sleep behavior.  If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep.
If a utility is specified, caffeinate creates the assertions on the utility's behalf, and those assertions will persist for the duration of the utility's execution.
Otherwise, caffeinate creates the assertions directly, and those assertions will persist until caffeinate exits.

- Page: https://loobins.io/binaries/caffeinate/
- Author: Ethan Nay
- Created: 2023-07-12
- Tactics: Execution, Defense Evasion

## Paths

- `/usr/bin/caffeinate`

## Example Use Cases

### Fork a process

Make caffeinate fork a process and hold an assertion that prevents idle sleep as long as that process is running

```bash
caffeinate -i /tmp/evil
```

- Tactics: Execution, Defense Evasion
- Tags: bash, zsh

### Prevent a sleep

Prevent a macOS from going to sleep for 4 hours (14400 seconds)

```bash
caffeinate -u -t 14400
```

- Tactics: Execution
- Tags: bash, zsh

## Detections

- No detections at time of publishing

## Resources

- [macOS/binaries/caffeinate](https://macosbin.com/bin/caffeinate)
- [caffeinate man page](https://ss64.com/osx/caffeinate.html)
