Uninstall Elastic Agents from edge hosts
editUninstall Elastic Agents from edge hosts
editUninstall on macOS, Linux, and Windows
editTo uninstall Elastic Agent, run the uninstall
command from the directory where
Elastic Agent is running:
You must run this command as the root user.
sudo /Library/Elastic/Agent/elastic-agent uninstall
You must run this command as the root user.
sudo /opt/Elastic/Agent/elastic-agent uninstall
Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select Run As Administrator).
From the PowerShell prompt, run:
C:\"Program Files"\Elastic\Agent\elastic-agent.exe uninstall
Follow the prompts to confirm that you want to uninstall Elastic Agent. The command stops and uninstalls any managed programs, such as Beats and Elastic Endpoint, before it stops and uninstalls Elastic Agent.
If you run into problems, refer to Troubleshoot common problems.
If you are using DEB or RPM, you can use the package manager to remove the installed package.
Remove Elastic Agent files manually
editYou might need to remove Elastic Agent files manually if there’s a failure during installation.
To remove Elastic Agent manually from your system:
- Unenroll the agent if it’s managed by Fleet.
- For standalone agents, back up any configuration files you want to preserve.
-
On your host, stop the agent. If any Elastic Agent-related processes are still running, stop them too.
Search for these processes and stop them if they’re still running:
filebeat
,metricbeat
,fleet-server
, andelastic-endpoint
. -
Manually remove the Elastic Agent files from your system. For example, if you’re
running Elastic Agent on macOS, delete
/Library/Elastic/Agent/*
. Not sure where the files are installed? Refer to Installation layout. -
If you’ve configured the Elastic Endpoint integration, also remove the files installed for endpoint protection. The directory structure is similar to Elastic Agent, for example,
/Library/Elastic/Endpoint/*
.When you remove the Elastic Endpoint integration from a macOS host (10.13, 10.14, or 10.15), the Endpoint System Extension is left on disk intentionally. If you want to remove the extension, refer to the documentation for your operating sytem.