How to install and uninstall Elasticsearch on Mac

How to install:

brew tap elastic/tap
brew install elastic/tap/elasticsearch-full

From:

https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html

How to uninstall

#!/usr/bin/env sh

# checks to see if running 
launchctl list | grep elasticsearch
 
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch

pkill -f elasticsearch

rm -f ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist

brew uninstall elasticsearch

# double check existence
ls -al /usr/local/bin/elasticsearch*
ls -al ~/Library/LaunchAgents

From:

https://gist.github.com/jkubacki/e2dd904bd648b0bd4554