Change Jenkins port on macOS Change Jenkins port on macOS jenkins jenkins

Change Jenkins port on macOS


it looks like the default way is:

#add the default parameters - this will edit /Library/Preferences/org.jenkins-ci.plist

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

#stop

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

#start

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


Before modify the Jenkins port on macOS,you must pay attention to the way of installation of Jenkins.

Here I recommend you install Jenkins by 'Homebrew' if you want to deal with iOS project building,because you may meet some errors that the way of using .pkg to install,it's really hard to solve the problems.

I have installed Jenkins LTS by brew command:

brew install jenkins-lts

So my Jenkins plist file is here:

/usr/local/Cellar/jenkins-lts/2.121.2/homebrew.mxcl.jenkins-lts.plist

You can modify the httpPort value from default 8080 to the other value,and then save the file.

<?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>homebrew.mxcl.jenkins-lts</string> <key>ProgramArguments</key> <array> <string>/usr/libexec/java_home</string> <string>-v</string> <string>1.8</string> <string>--exec</string> <string>java</string> <string>-Dmail.smtp.starttls.enable=true</string> <string>-jar</string> <string>/usr/local/opt/jenkins-lts/libexec/jenkins.war</string> <string>--httpListenAddress=127.0.0.1</string> <string>--httpPort=8383</string> </array> <key>RunAtLoad</key> <true/> </dict></plist>

sudo launchctl unload command will not work for you.You must try these commands to restart your Jenkins and make the port modification works.

brew services stop jenkins-ltsbrew services start jenkins-lts

ifeegoo:~ ifeegoo$ brew services stop jenkins-ltsStopping `jenkins-lts`... (might take a while)==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)ifeegoo:~ ifeegoo$ brew services start jenkins-lts==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)

Note:If you installed Jenkins LTS,you must pay attention that your command must be jenkins-lts,not jenkins.


I'll walk you through it:

cd /Applications/Jenkinssudo vi winstone.propertiesAdd httpPort=9999 to the file. To see all the options you can put in there type java -jar jenkins.war --help

run java -jar jenkins.war from /Applications/Jenkins. Your port will be changed. jenkins.war picks up config options from ./winstone.properties by default.

Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ pwd/Applications/JenkinsAndrew-Finnells-MacBook-Pro:Jenkins afinnell$ ls -altotal 87928drwxr-xr-x   4 root  wheel       136 Aug 21 12:32 .drwxrwxr-x+ 83 root  admin      2822 Aug 21 12:05 ..-rwxr-xr-x   1 root  wheel  45014470 Aug 19 13:14 jenkins.war-rw-r--r--   1 root  wheel        14 Aug 21 12:32 winstone.propertiesAndrew-Finnells-MacBook-Pro:Jenkins afinnell$ sudo cat winstone.properties httpPort=9494Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ java -jar jenkins.warRunning from: /Applications/Jenkins/jenkins.warwebroot: $user.home/.jenkins[Winstone 2011/08/21 12:33:19] - Beginning extraction from war fileJenkins home directory: /Users/afinnell/.jenkins found at: $user.home/.jenkins[Winstone 2011/08/21 12:33:21] - HTTP Listener started: port=9494