1. Install Homebrew (if not installed)

If you don’t have Homebrew installed, do this first:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2. Install Java (Required for Jenkins)

Jenkins requires Java (preferably Java 11 or higher). You can install Java using Homebrew:

brew install openjdk@17

After installation, set the JAVA_HOME environment variable:

echo 'export PATH="/usr/local/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
echo 'export JAVA_HOME="$(/usr/libexec/java_home -v 17)"' >> ~/.zshrc
source ~/.zshrc

Verify Java installation by checking the version:

java -version

3. Install Jenkins via Homebrew

Now that Java is installed, install Jenkins using Homebrew:

brew install jenkins-lts

4. Start Jenkins

To start Jenkins as a background service, run:

brew services start jenkins-lts

Alternatively, you can start Jenkins manually:

jenkins-lts

5. Access Jenkins

Open your browser and navigate to:

http://localhost:8080

6. Unlock Jenkins

To unlock Jenkins, you will need the initial admin password, which you can retrieve using this command:

cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Paste the password into the Jenkins setup screen.

7. Complete the Setup

Follow the on-screen instructions to:

  1. Install recommended plugins.

Select Install Suggested plugins--

  1. Create an admin user:

After the plugin setup is complete, Jenkins will prompt you to create an administrator user. Fill in the details in the respective fields and click on Save and Finish. Take a look at this screenshot:

s

Now Jenkins will be fully operational on your macOS machine and can only be accessed through valid credentials.