After upgrading my macOS to Sierra, when I start Jenkins using launchctl load I cannot connect to localhost:8080. If I call launchctl load again, I see response \"service alread
I fixed it by setting the appropriate JAVA_HOME
variable. The way I diagnosed it was to look at the errors that were thrown as Jenkins was trying to run:
tail -f /var/log/jenkins/jenkins.log
Then I tried to run it:
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
If it says it's already loaded, unload it first:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then run it:
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
The error I saw was that Jenkins needed Java 8, not Java 10. So I unloaded:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
and then installed Java 8. Then I edited the plist
file:
sudo nano /Library/LaunchDaemons/org.jenkins-ci.plist
and added the appropriate JAVA_HOME
environment variable:
JENKINS_HOME
/Users/Shared/Jenkins/Home
JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Finally, I tried the launchctl
command again:
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
and voilà!