Guide to Installing and Configuring Jenkins CI on macOS
This tutorial explains how to install Jenkins on macOS using Homebrew, configure it as a launch agent, adjust JVM memory and garbage‑collection settings, set HTTP proxy, customize ports and prefixes, and create a complete launchd plist for a reliable 24/7 CI server.
Installation
To install Jenkins on a Mac, first ensure JDK is installed and then run the Homebrew command: brew install jenkins The package is placed under /usr/local. Homebrew provides instructions to create a launch agent:
ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plistInstead of symlinking the plist, copy it to avoid losing changes after Homebrew upgrades. Pin the formula to prevent automatic upgrades: brew pin jenkins You can start and stop Jenkins manually:
# Start.
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
# Stop.
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plistConfiguration
Running the server reveals memory‑related errors; adjust the JVM options in the launchd plist. Set a 64‑bit model, initial and maximum heap size, and enable a concurrent garbage collector.
<string>-d64</string>
<string>-Xms512m</string>
<string>-Xmx512m</string>
<string>-XX:+UseConcMarkSweepGC</string>
<string>-XX:+CMSClassUnloadingEnabled</string>
<string>-XX:MaxPermSize=256m</string>HTTP Proxy
If a corporate proxy is required, add the proxy host and port options:
<string>-Dhttp.proxyHost=my-company-proxy-host.com.au</string>
<string>-Dhttp.proxyPort=8080</string>Port and Prefix
Run Jenkins on a custom port (default 8080) with a URL prefix such as /jenkins. These arguments are passed to jenkins.war located in /usr/local/opt/jenkins/libexec:
<string>-jar</string>
<string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
<string>--httpListenAddress=127.0.0.1</string>
<string>--httpPort=8080</string>
<string>--prefix=/jenkins</string>Run at Load
Enable automatic start after reboot by setting RunAtLoad to true in the plist:
<key>RunAtLoad</key>
<true/>Environment Variables
Define any required environment variables, for example the HTTP proxy:
<key>EnvironmentVariables</key>
<dict>
<key>HTTP_PROXY</key>
<string>http://my-company-proxy-host.com.au:8080</string>
</dict>Standard Output and Error
Redirecting stdout/stderr is optional; the author advises against redirecting stderr to a file due to large log growth.
<!--
<key>StandardOutPath</key>
<string>/Users/i4niac/.jenkins/log/output.log</string>
-->
<key>StandardErrorPath</key>
<string>/Users/i4niac/.jenkins/log/error.log</string>Jenkins stores its files under the .jenkins directory in the user’s home folder; ensure a log subdirectory exists.
Full Configuration
The complete launchd plist combines all the above settings:
<?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</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-server</string>
<string>-d64</string>
<string>-Xms512m</string>
<string>-Xmx512m</string>
<string>-Dmail.smtp.starttls.enable=true</string>
<string>-XX:+UseConcMarkSweepGC</string>
<string>-XX:+CMSClassUnloadingEnabled</string>
<string>-XX:MaxPermSize=256m</string>
<string>-Djava.net.preferIPv4Stack=true</string>
<string>-Dhttp.proxyHost=my-company-proxy-host.com.au</string>
<string>-Dhttp.proxyPort=8080</string>
<string>-jar</string>
<string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
<string>--httpListenAddress=127.0.0.1</string>
<string>--httpPort=8080</string>
<string>--prefix=/jenkins</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>HTTP_PROXY</key>
<string>http://my-company-proxy-host.com.au:8080</string>
</dict>
</dict>
</plist>With this configuration, Jenkins runs continuously and can reliably execute CI jobs.
Tips
To verify how Jenkins was started, inspect the process list: ps aux | grep java The output shows the Java command line with all JVM options and the path to jenkins.war. After installation, further steps such as installing plugins, configuring SSH keys for Git, and other management tasks are required to fully operationalize the CI server.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
