'Jenkins server is not accessible by host name (ip address)

I setup jenkins on my Mac OS X with homebrew and it works just fine via http://localhost:8080 or http://127.0.0.1:8080 I couldn't access jenkins instance via hostname/ipaddress:

 1. http://myjenkinshost.local:8080
 2. http://192.168.0.100:8080

Both links are not accessible even from local computer (jenkins host itself). Same time commands ping 192.168.0.100 and ping myjenkinshost.local work just fine.



Solution 1:[1]

It turned out that launch agent was configured to listen only 127.0.0.1 (or localhost). To fixed that edit jenkins agent's plist:

nano /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

and modify httpListenAddress to 0.0.0.0 instead of 127.0.0.1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.jenkins</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
      <string>-Dmail.smtp.starttls.enable=true</string>
      <string>-jar</string>
      <string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
      <string>--httpListenAddress=0.0.0.0</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Solution 2:[2]

The correct location of the file to edit is /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist

Found the answer here

Solution 3:[3]

By starting jenkins using sudo /etc/init.d/jenkins restart instead of sudo service jenkins start started the browser access. I hope it will be helpful.

Solution 4:[4]

At my macOS 11.4 Big Sur installation the plist file was found here:

/opt/homebrew/Cellar/jenkins-lts/2.xxx.x/homebrew.mxcl.jenkins-lts.plist

Changing ip address to 0.0.0.0 worked as described.

Solution 5:[5]

I came across something like this but, it was for windows,I'm sure the steps to resolve will be the same,Please give it a try: https://apple.stackexchange.com/questions/31376/how-can-i-open-port-8080-of-mac-os-x-lion

Solution 6:[6]

If your Jenkins running through Homebrew (macos), don't touch /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

Use this one: /usr/local/Cellar/jenkins/2.xxx/homebrew.mxcl.jenkins.plist

Change httpListenAddress to 0.0.0.0

Solution 7:[7]

  1. If you have installed Jenkins LTS using Homebrew(macos)

    macOS Installers for Jenkins LTS

  1. The path of the file homebrew.mxcl.jenkins-lts.plist is:

     /opt/homebrew/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist
    
  2. Since the the folder opt is a hidden folder on macOS. You will need to do the following to see it in finder.

    Open Macintosh HD in finder -> and press cmd + shift + [.]

    This will reveal all hidden folders.

  3. You now have everything you need to make the required changes. As stated in previous answers.

Solution 8:[8]

If your Jenkins running through Homebrew (macOS Big Sur),

First things first, you need to unhide the hidden folders.

Since the folder is a hidden folder on macOS. so you will need to do the following things to unhide the folder.

Open Macintosh HD in finder -> and press cmd + shift + . (dot)

This will reveal all hidden folders.

After you unhidden the folder, paste the below command in the terminal:

nano /usr/local/Cellar/jenkins-lts/2.xxx/homebrew.mxcl.jenkins-lts.plist

Change httpListenAddress 127.0.0.1 to 0.0.0.0

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.jenkins</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
      <string>-Dmail.smtp.starttls.enable=true</string>
      <string>-jar</string>
      <string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
      <string>--httpListenAddress=0.0.0.0</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Once the above steps are done, you can access the Jenkins using hostname or public ip address.

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 DreamTeam Mobile
Solution 2 jinjorge
Solution 3 hvaughan3
Solution 4 cyx
Solution 5 Community
Solution 6 Amazonian
Solution 7 Steve-Buglione
Solution 8 Ojer_Dev