Jenkins does not start on macOS 10.12 (Sierra)

前端 未结 9 1745
既然无缘
既然无缘 2021-02-01 19:16

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

相关标签:
9条回答
  • 2021-02-01 19:25

    I had the same issue, installing the JDK didn't made the trick

    However changing the rights of the log directory (in my case /var/log/jenkins) and restarting Jenkins worked.

    Seems that moving to Sierra changed the rights on this folder.

    0 讨论(0)
  • 2021-02-01 19:26

    This same thing happened to me when I upgraded from Sierra to High Sierra. I followed the instructions outlined above by mac.slusarek, however the jenkins ID no longer existed on my computer. I created the jenkins id as a Standard user. Also, the files under /Users/Shared/Jenkins were no longer owned by jenkins. After I cat out the error log with the command:

    sudo cat /var/log/jenkins/jenkins.log
    

    After seeing the error:

    Exception in thread "main" java.io.IOException: Jenkins has failed to create a 
    temporary file in /Users/Shared/Jenkins/tmp
        at Main.extractFromJar(Main.java:368)
        at Main._main(Main.java:210)
        at Main.main(Main.java:112)
     Caused by: java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createTempFile(File.java:2024)
        at Main.extractFromJar(Main.java:365)
        ... 2 more
    

    I fixed the ownership with the command:

    sudo chown -R jenkins /Users/Shared/Jenkins
    
    0 讨论(0)
  • 2021-02-01 19:28

    Seems that Sierra changed the permission of Jenkis folder. So the best solution is:
    1. Add execute permissions to org.jenkins-ci.plist:
    sudo chmod +x /Library/LaunchDaemons/org.jenkins-ci.plist
    2. Set jenkins as the owner of /var/log/jenkins:
    sudo chown jenkins /var/log/jenkins
    3. Start Jenkins:
    sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

    0 讨论(0)
  • 2021-02-01 19:29

    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:

    <dict>
       <key>JENKINS_HOME</key>
       <string>/Users/Shared/Jenkins/Home</string>
       <key>JAVA_HOME</key>
       <string>/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home</string>
    </dict>
    

    Finally, I tried the launchctl command again:

    sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist
    

    and voilà!

    0 讨论(0)
  • 2021-02-01 19:35

    I was facing issue in loading jenkins-cli.plist command on my MacOs(Mojave version).

    Mac Version : Mojave 10.14.6 Jenkins Version : 2.190.1

    I installed jenkins using .pkg file.

    Reference link : https://java2blog.com/install-jenkins-mac-os-x/

    When executing below command,

    sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

    I was facing error saying "already loaded".

    Solution:

    step 1. Check jenkins logs for exact error.

    tail -f /var/log/jenkins/jenkins.log

    (In my case, it was port binding issue, port 8080 was already being used by some other application)

    step 2. So I decided to start jenkins on some other port (say 7070).You can do this by using below commands.

    sudo defaults write /Library/Preferences/org.jenkins-ci.plist httpPort 7070

    sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

    step 3. Try to access it in browser, http://localhost:7070. It should work!!

    0 讨论(0)
  • 2021-02-01 19:38

    In my case, the install on Catalina (OSX 10.15) somehow didn't even create the /var/log/jenkins file. I had to

    sudo mkdir /var/log/jenkins
    

    and then take ownership and then Jenkins started normally. Just did the normal OSX installer so not sure why the install was corrupt.

    0 讨论(0)
提交回复
热议问题