Skip to content

Instantly share code, notes, and snippets.

@cino
Last active May 3, 2019 06:33
Show Gist options
  • Save cino/9a4764c8c7c21223d50f39f03b6caeb5 to your computer and use it in GitHub Desktop.
Save cino/9a4764c8c7c21223d50f39f03b6caeb5 to your computer and use it in GitHub Desktop.
Install elasticsearch 7.0.1 and add it to startup on macOS
#!/bin/bash
echo "Download and copy elasticsearch to ~/Applications"
curl -o elasticsearch.tar.gz 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-darwin-x86_64.tar.gz'
tar -xzf elasticsearch.tar.gz
cp -a elasticsearch-7.0.1 ~/Applications/elasticsearch
rm -rf elasticsearch-7.0.1 elasticsearch.tar.gz
echo "Download example .plist and move to ~/Library/LaunchAgents"
curl -o elasticsearch.plist 'https://gist.githubusercontent.com/cino/395f62c2cddf402320a25fd4dd582462/raw/f11298034e52916bddbc07469cde7e376031a430/elasticsearch.plist' > /dev/null 2>&1
cp elasticsearch.plist ~/Library/LaunchAgents/elasticsearch.plist
rm elasticsearch.plist
echo "Modify custom launchagent to include correct username"
sed -i '' 's/{{username}}/'$USER'/g' ~/Library/LaunchAgents/elasticsearch.plist
echo "Register LaunchAgent"
launchctl load -w ~/Library/LaunchAgents/elasticsearch.plist
echo "Starting elasticsearch"
cd ~ && ./Applications/elasticsearch/bin/elasticsearch -d -p pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment