Sign in

Installing the Moleant Inventory Agent on macOS

Installation guide · script version 0.5

The Moleant Inventory Agent collects an inventory of your Mac and sends it to Moleant. Once installed, it runs automatically as a background service every 6 hours. This guide walks you through testing it safely and installing it.

Before you start

You will need:

  • A Mac running macOS, with an administrator account (you will be asked for your password).
  • Your Organisation ID (orgid). It looks like 5da99061b8f6af83f0e5d2cf. You can find it in Moleant Discover under Settings, in the Permissions tab.
  • These three files, saved together in the same folder: moleant-inventory.sh, install.sh and uninstall.sh.
  • An internet connection that can reach https://api.moleant.com.

Nothing else needs to be installed. The scripts only use tools that already come with macOS.

What information is collected

  • Computer name, serial number, model, macOS version, last restart and setup date
  • Network adapters: MAC address, IP addresses, subnets, gateway, DNS servers and routes
  • Local user accounts and groups
  • Installed applications (name, version, install date, publisher)
  • System services (launchd): name, running state, account and program path
  • Processor, memory and disks (size and usage)

The agent does not read your documents, e-mail, browsing history or passwords.

Step 1 – Open Terminal

Press Cmd + Space, type Terminal and press Enter.

Step 2 – Go to the folder with the files

Change to the folder where you saved the three files. For example, if they are in your Downloads folder:

cd ~/Downloads

If the folder name contains spaces, put the path in quotes:

cd "/Users/yourname/Documents/Moleant/Macbook engine"

Check that the files are there:

ls moleant-inventory.sh install.sh uninstall.sh

Step 3 – Make the scripts runnable

chmod +x moleant-inventory.sh install.sh uninstall.sh

If the files were downloaded from the internet, macOS may refuse to run them. Remove the download warning flag with:

xattr -d com.apple.quarantine moleant-inventory.sh install.sh uninstall.sh

(If this command reports that the attribute does not exist, that is fine – continue.)

Step 4 – Test without sending anything (optional)

This collects the inventory and saves it to a file on your Mac. Nothing is sent to Moleant.

./moleant-inventory.sh --dry-run > result.json

It takes about 20–60 seconds. You will see progress lines such as Applications and Network. A warning that the script is not running as root is expected here.

Open the result to see exactly what would be sent:

open -e result.json

Step 5 – Install the service

Replace YOUR_ORG_ID with your Organisation ID from Moleant Discover → Settings → Permissions:

sudo ./install.sh --orgid YOUR_ORG_ID

Terminal asks for your Mac password. While you type it, nothing appears on screen – this is normal. Press Enter when done.

The service starts immediately, so the first inventory is sent to Moleant right away (api.moleant.com). After that it runs every 6 hours and every time the Mac starts. Review result.json from Step 4 first if you are unsure.

The installer:

  • copies the script to /usr/local/libexec/moleant-inventory.sh,
  • saves your Organisation ID in /usr/local/etc/moleant/agent.conf (readable by the administrator only),
  • installs and starts a background service named com.moleant.agent.

You do not need to keep the downloaded files after installing, except to uninstall or update later.

Step 6 – Check that it works

Look at the service status:

sudo launchctl print system/com.moleant.agent | grep -E 'state|last exit'

last exit code = 0 means the last run succeeded. The service shows as not running between runs – that is normal, it only runs briefly every 6 hours.

Read the log of what the agent did:

tail -n 20 /var/log/moleant-agent.log

A successful run ends with Script done. Your Mac should now also appear in Moleant Discover.

If the Mac is asleep at the scheduled time, the run happens when it wakes up.

Updating

To install a new version of the script, replace the files in your folder and run Step 5 again. The old service is replaced. You can leave out --orgid – the saved one is kept.

Troubleshooting

MessageWhat to do
Permission denied Run the chmod +x command from Step 3.
command not found You are in the wrong folder (Step 2), or you left out ./ before the file name.
Please run as root Put sudo in front of the command.
moleant-inventory.sh not found next to the installer install.sh and moleant-inventory.sh must be in the same folder.
Invalid orgid The ID may only contain letters, digits, - and _. Check for spaces or typos.
Upload failed (curl exit code …) in the log The Mac could not reach Moleant, or the Organisation ID was rejected. Check your internet connection and the ID. The next run happens automatically, or run sudo launchctl kickstart system/com.moleant.agent to try again now.
macOS says the file cannot be verified Run the xattr command from Step 3.

For anything else, contact your Moleant administrator and include the full text of the message and the last lines of the log.

Uninstalling

This stops the service and removes the installed script. The saved Organisation ID and the log are kept:

sudo ./uninstall.sh

To remove those as well:

sudo ./uninstall.sh --purge

Afterwards you can delete the downloaded files and result.json.