Skip to content

[BUG] MacOS agent install script fails #14316

Open
@goodspark

Description

@goodspark

Describe what happened:

Agent installation failed on a Mac machine.

* Restarting the Agent...

+ '[' false '!=' true ']'
+ sudo -Eu ec2-user launchctl stop com.datadoghq.agent
Not privileged to stop service.
++ on_error
++ printf '\033[31m
It looks like you hit an issue when trying to install the Agent.

Describe what you expected:

For the install to complete with no issues.

Steps to reproduce the issue:

Ran the install script, from the DD agent installation page. Except I made a small change (added a set -x to the top) so I can see exactly where the script is failing.

wget https://s3.amazonaws.com/dd-agent/scripts/install_mac_os.sh
# Add set -x to top of the script
DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=SECRET_API_KEY DD_SITE="datadoghq.com" bash install_mac_os.sh

Additional environment details (Operating System, Cloud provider, etc):
MacOS Monterey, 12.6.1
M1 CPU

I believe the condition is incorrect here: https://github.com/DataDog/datadog-agent/blob/main/cmd/agent/install_mac_os.sh#L288

Since I didn't specify DD_SYSTEMDAEMON_INSTALL=true, systemdaemon_install will be false. And the logic here tries to stop a launchd service that doesn't exist. There's nothing in the script that sets that variable aside from reading the value of the daemon install env var. I think the fix is just flipping the logic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions