Skip to content

Instantly share code, notes, and snippets.

@danbruder
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbruder/f64930d278d999a0d0e7 to your computer and use it in GitHub Desktop.
Save danbruder/f64930d278d999a0d0e7 to your computer and use it in GitHub Desktop.
Install Selenium Server on OSX
#!/bin/sh
run () {
RELEASE="2.44"
PREFIX="/usr/local/lib"
JAR_URL="http://selenium-release.storage.googleapis.com/${RELEASE}/selenium-server-standalone-${RELEASE}.0.jar"
PLIST_URL="https://gist.githubusercontent.com/danbruder/f64930d278d999a0d0e7/raw/4b9792774a4d91b22745b6679a42677bded153d3/selenium.plist"
# Unload running process
if launchctl list | grep -q "selenium"; then
echo "unloading old process"
launchctl unload ${HOME}/Library/LaunchAgents/selenium.plist
fi
# Remove old symlinks if need be
if [ -L "/usr/local/lib/selenium-server.jar" ]; then
echo "unlinking jar"
unlink /usr/local/lib/selenium-server.jar
fi
# Remove old plist if need be
if [ -L "${HOME}/Library/LaunchAgents/selenium.plist" ]; then
echo "unlinking plist"
unlink ${HOME}/Library/LaunchAgents/selenium.plist
fi
# Remove old installation
if [ -d "${HOME}/.selenium" ]; then
echo "removing old selenium intall"
rm -rf ${HOME}/.selenium
fi
echo "downloading selenium server"
mkdir ${HOME}/.selenium
curl --progress-bar --fail ${JAR_URL} > ${HOME}/.selenium/selenium-server.jar
curl -s $PLIST_URL > ${HOME}/.selenium/selenium.plist
# Link to selenium jar file
echo "linking jar"
ln -s ${HOME}/.selenium/selenium-server.jar /usr/local/lib/selenium-server.jar
# Link plist
echo "linking plist"
ln -s ${HOME}/.selenium/selenium.plist ${HOME}/Library/LaunchAgents/selenium.plist
# Load plist
launchctl load ${HOME}/Library/LaunchAgents/selenium.plist
echo "You're all set! Selenium is running on port 4444."
}
run
<?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>Label</key>
<string>selenium</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
<string>/usr/local/lib/selenium-server.jar</string>
</array>
<key>ServiceDescription</key>
<string>Selenium Server</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment