Continuous integration currently tests stable release versions of osquery against macOS 10.14 (as listed under the Build_status column on the project README). There are no reported issues which block expected core functionality on 10.11 and greater, however 10.9 and previous macOS versions do not work.

Package Installation

If you plan to manage an enterprise osquery deployment, the easiest installation method is a macOS package installer. You will have to manage and deploy updates.

Each osquery tag (release) builds a macOS package: osquery.io/downloads. There are no package or library dependencies.

The default package creates the following structure:

  1. /private/var/osquery/com.facebook.osqueryd.plist
  2. /private/var/osquery/osquery.example.conf
  3. /private/var/log/osquery/
  4. /private/var/osquery/lenses/{*}.aug
  5. /private/var/osquery/packs/{*}.conf
  6. /usr/local/lib/osquery/
  7. /usr/local/bin/osqueryctl
  8. /usr/local/bin/osqueryd
  9. /usr/local/bin/osqueryi

This package does NOT install a LaunchDaemon to start osqueryd. You may use the osqueryctl start script to copy the sample launch daemon job plist and associated configuration into place.

Post installation steps

Only applies if you have never installed and run osqueryd on this Mac.

After completing the brew installation run the following commands. If you are using the chef recipe to install osquery then these steps are not necessary, the recipe has this covered.

  1. sudo ln -s /var/osquery /usr/local/share/osquery
  2. sudo mkdir /var/log/osquery
  3. sudo chown root /usr/local/Cellar/osquery/1.7.3/bin/osqueryd
  4. sudo cp /var/osquery/osquery.example.conf /var/osquery/osquery.conf

Removing osquery

To remove osquery from a macOS system, run the following commands:

  1. # Unload and remove com.facebook.osquery.plist launchdaemon
  2. launchctl unload /Library/LaunchDaemons/com.facebook.osqueryd.plist
  3. rm /Library/LaunchDaemons/com.facebook.osqueryd.plist
  4. # Remove files/directories created by osquery installer pkg
  5. rm -rf /private/var/log/osquery
  6. rm -rf /private/var/osquery
  7. rm /usr/local/bin/osquery*
  8. pkgutil --forget com.facebook.osquery

Running osquery

To start a standalone osquery use: osqueryi. This does not need a server or service. All the table implementations are included!

After exploring the rest of the documentation you should understand the basics of configuration and logging. These and most other concepts apply to osqueryd, the daemon, tool. To start the daemon as a LaunchDaemon:

  1. $ sudo cp /var/osquery/osquery.example.conf /var/osquery/osquery.conf
  2. $ sudo cp /var/osquery/com.facebook.osqueryd.plist /Library/LaunchDaemons/
  3. $ sudo launchctl load /Library/LaunchDaemons/com.facebook.osqueryd.plist

NOTICE: The interactive shell and daemon do NOT communicate!