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 jenkinsThe 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 jenkinsYou 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.
StandardErrorPath
/Users/i4niac/.jenkins/log/error.logJenkins 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"?>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 javaThe 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.
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.