Huntress Agent (Install) - MAC
Summary
This task will first check if Huntress is installed. If it is not, the script will attempt to install the agent and log the result for MAC machines.
Note: Huntress Agent requires macOS 13.0.0 or later.
Create Script
- Go to
Automation>Tasks - At the top-right corner, click on the
Adddropdown menu and selectScript Editor
Task Details:
- Name: Huntress Agent (Install) - MAC
- Description: This task will check if Huntress is installed. If not, it will attempt to install the agent and log the result for MAC machines.
- Category: Custom
Script
Row 1 Function: Set Pre-defined Variable
-
Select
Set Pre-Defined VariableFunction
-
Select
Custom Field -
Input
acctKeyas Variable name -
Select
Huntress Acct_Keyor (Huntress Account Key) custom field from the dropdown -
Click
Save
Row 2 Function: Set Pre-defined Variable
-
Select
Set Pre-Defined VariableFunction
-
Select
Custom Field -
Input
orgKeyas Variable name -
Select
Huntress Org_Keycustom field from the dropdown -
Click
Save
Row 3 Function: Set Pre-defined Variable
-
Select
Set Pre-Defined VariableFunction
-
Select
Custom Field -
Input
tagsas Variable name -
Select
Huntress Tagcustom field from the dropdown -
Click
Save
Row 4 Function: Script Log
Input the following:
The script will detect the Huntress Agent and if the agent is not found then it will install the agent.
acct_key : @acctKey@
org_key: @orgKey@
Tags: @tags@
Attempting to download the file using acct_key from the huntress website as below:
https://huntress.io/script/darwin/@acctKey@, and once downloaded the agent will be attempted to install.
Row 5 Function: Bash Script
Paste the following PowerShell script and set the expected script execution time to 900 seconds. Set this step to Continue on Failure

Step 6 Function: Script Log
- Add a new row by clicking the
Add Rowbutton - Search and select the
Script Logfunction. - Input the following:
Step 7 Logic: If/Then
- Add a new
If/Thenlogic from theAdd Logicdropdown menu.
Row 7a Condition: Output Contains
- Type
Huntress agent is installedin the Value box.
Row 7b Function: Set Custom Field
-
Add a new row in the
IfSection by clicking theAdd Rowbutton -
Search and select the
Set Custom Fieldfunction.
-
Search and select the
Huntress Deploy_ResultCustom Field. -
Type
Successfully Installedin theValuebox and click the Save button.
Row 7c Function: Script Exit
-
Add a new row in the
IfSection by clicking theAdd Rowbutton -
Search and select the
Script Exitfunction. -
Leave the value blank to allow the script to exit on success.
Step 8 Function: Script Exit
- Add a new row after the
If/ThenSection by clicking theAdd Rowbutton - Search and select the
Script Logfunction. - Input the following:
Completed Script

Script Deployment
This task must be scheduled on Deploy Huntress - MAC, the group for auto-deployment. The script can also be run manually if required.
- Go to
Automations>Tasks. - Search for
Huntress Agent (Install) - MAC. - Then click on Schedule and select the Target:

Select the group "Deploy Huntress - MAC" and save the selection.

Once selected, click on Run to schedule the script as per requirement.
Output
- Script log
Changelog
2025-10-01
- The script was failing to install the Huntress Agent on MAC. Fixed the bug and updated the script to write the installation script instead of downloading it.
2025-04-10
- Initial version of the document