# MacProcesses

Import: `import com.install4j.api.macos.MacProcesses;`

```java
public class MacProcesses
```

Collection of static methods to check for running processes on macOS and terminate them.

| Type | Kind | Description |
|---|---|---|
## Nested types

| [MacProcesses.Info](MacProcesses.Info.md) | class | Class that holds information about running macOS processes. |

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getRunningProcesses()`](#getrunningprocesses) | `Info[]` | Get a list of all running processes the installer can see. |
| [`terminateProcesses(int[], boolean, int)`](#terminateprocesses-int-boolean-int) | `boolean` | Tries to terminate the processes with the given ids by executing the `kill` command. |
| [`areInstalledLaunchersRunning()`](#areinstalledlaunchersrunning) | `boolean` | Determine if any of the installed launchers are currently running. |

### getRunningProcesses()

```java
public static Info[] getRunningProcesses()
```

Get a list of all running processes the installer can see.


**Returns:** info objects with module name, process id and further information

### terminateProcesses(int[], boolean, int)

```java
public static boolean terminateProcesses(int[] processIds, boolean force, int timeout)
```

Tries to terminate the processes with the given ids by executing the `kill` command.


**Parameters:**

- `processIds` — the processes to terminate
- `force` — if the process should be killed with `kill -9`
- `timeout` — the maximum time to wait for the processes to terminate after the signal has been sent in milliseconds.
The minimum time is 400 ms regardless of a lower setting.

**Returns:** `true` if all processes have been terminated.

### areInstalledLaunchersRunning()

```java
public static boolean areInstalledLaunchersRunning()
```

Determine if any of the installed launchers are currently running. All launchers in the currently set installation directory
are checked. The "Install Files" action performs this check by default and warns the user that processes are running.
With this method, you can check for this condition earlier in your installer.


**Returns:** `true` or `false`.

## Constructors

| Signature | Description |
|---|---|
| [`MacProcesses()`](#macprocesses) |  |

### MacProcesses()

```java
public MacProcesses()
```

