'Cannot start jenkins-lts on mac using homebrew

I am trying to install/run jenkins on a mac machine using homebrew. This is what I did

  1. brew install jenkins-lts
    On running this command. I see that jenkins-lts is installed and I see this message

    Note: When using launchctl the port will be 8080.
    To have launchd start jenkins-lts now and restart at login:
    brew services start jenkins-lts.
    Or, if you don't want/need a background service you can just run:
    jenkins-lts

  2. If I run jenkins-lts, Jenkins starts at port 8080 successfully. I can reach it from the browser.

  3. If I run brew services start jenkins-lts . I see the message Successfully started jenkins-lts (label:homebrew.mxcl.jenkins-lts)

    But I cannot reach the server on port 8080. I tried checking the status of the service

  4. I tried checking the status of the service brew services list

     Name        Status  User     Plist  
    jenkins-lts unknown ec2-user /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist
    

I see that status is unknown.

  1. After a while I see that this service is not listed anymore in the brew services list command. If I try to start it again. I see this message

    /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist: service already loaded Error: Failure while executing; /bin/launchctl bootstrap gui/501 /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist exited with 37

Where can I find the jenkins logs and how to get it working.



Solution 1:[1]

The issue here is that, macos was running as a dedicated host on AWS.

I was connected to this macos from my windows machine using putty and trying to run the command.

brew services start jenkins-lts

This does not work. I had to login to macos via some Remote Desktop client like VNC and then run the same command from the the terminal window of mac.
In some cases, there will be a pop up which you needs user input. Hence this did not work when I was connected via putty from my windows machine.

Solution 2:[2]

likely you have not configured you host setings so after starting the service use http://127.0.0.1:8080/ not http://localhost:8080/

enter image description here

Solution 3:[3]

This is my experience , brew services list showed up as :

Name        Status  User    Plist
jenkins-lts error   cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.@CD6R ~

and the fix was:

1. brew services stop jenkins-lts

2. brew services start jenkins-lts 

and now brew services list showed up as :

Name        Status  User    Plist
jenkins-lts started cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.@CD6R ~

Solution 4:[4]

My solution was to uninstall Jenkins using brew (brew uninstall jenkins-lts), followed by brew doctor, followed by brew clanup, and re-install jenkins (brew install jenkins-lts).

After, I was able to start Jenkins using brew services start jenkins-lts. Your password will be available at $ cat /User/..../.jenkins/secrets/initialAdminPassword. Use it to create the admin account and continue the configuration.

Solution 5:[5]

We had the same issues on MacBooks and this is what fixed it.

run this:

    chmod u+w /usr/local/var/log

and then run this:

    sudu chown -R $(whoami) /usr/local/var/log

then:

    brew install jenkins-lts

and it worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pvpkiran
Solution 2 rio
Solution 3 Alferd Nobel
Solution 4 A O
Solution 5 bguiz