If you are like me you want most of the things to be automate like my previous post showing you how to run MongoDB on StartUp for Mac OS X, and this post I'm going to show you how to do that for elasticsearch.
Assuming you had elasticsearch installed (by HomeBrew).
If you simply run this:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
And try restart your Mac or your terminal you will see that your elasticsearch service has been started and ready to work on.
I'm don't think this will work for one that you install with MacPort or manual install, but this is the file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>homebrew.mxcl.elasticsearch</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/elasticsearch</string> <string>-f</string> <string>-D es.config=/usr/local/Cellar/elasticsearch/0.90.11/config/elasticsearch.yml</string> </array> <key>EnvironmentVariables</key> <dict> <key>ES_JAVA_OPTS</key> <string>-Xss200000</string> </dict> <key>RunAtLoad</key> <true/> <key>WorkingDirectory</key> <string>/usr/local/var</string> <key>StandardErrorPath</key> <string>/dev/null</string> <key>StandardOutPath</key> <string>/dev/null</string> </dict> </plist>
It might work if you have that file link and make sure all the path is correct above.