Jenkins installation in Mac OS

You might be wondering about the following terms like

  1. What is Jenkins?
  2. Why do we use Jenkins in Testing?
  3. How to start and from where to install?

All the questions triggered in your mind will be resolved at the completion of the document.

Firstly let us begin with the above questions eating up your mind for Jenkins setup and use.

Jenkin is the most popular, open-source Continuous Integration tool written in java. It has tons of plugins that enhance its functionality. In this documentation, you will learn to install Jenkins in mac OS.

Jenkins builds and tests our software projects which continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build.

It also allows us to continuously deliver our software by integrating with a large number of testing and deployment technologies.

With the help of Jenkins, one can speed up the software development process through automation. Jenkins adds development life-cycle processes of all kinds, including build, document, test, package, stage, deploy static analysis, and much more.

Letโ€™s see a generic flow diagram of Continuous Integration with Jenkins:

Working of Continuous Integration

Letโ€™s see how Jenkins works. The above diagram is representing the following functions:

  • First of all, a developer commits the code to the source code repository. Meanwhile, the Jenkins checks the repository at regular intervals for changes.
  • Soon after a commit occurs, the Jenkins server finds the changes that have occurred in the source code repository. Jenkins will draw those changes and will start preparing a new build.
  • If the build fails, then the concerned team will be notified.
  • If the build is successful, then the Jenkins server deploys the built-in test server.
  • After testing, the Jenkins server generates feedback and then notifies the developers about the build and test results.
  • It will continue to verify the source code repository for changes made in the source code and the whole process keeps on repeating.

Now let us start the installation process of Jenkins, however, before installing Jenkins one needs to know the prerequisites of it which are mentioned below as

Prerequisites:

Before you proceed to install Jenkins in your windows system, there are some prerequisites for Jenkins to install Jenkins on your computer.

Hardware requirements:

  • You need a minimum of 256 MB of RAM on your computer or laptop to install Jenkins
  • You need at least 1 GB of space on your hard drive for Jenkins.

Software Requirements:

  • Since Jenkins runs on Java, you need either the latest version of Java Development Kit (JDK) or Java Runtime Environment (JRE).
  • Java: see the Java Requirements page
  • Web browser: see the Web Browser Compatibility page

Installing Jenkins in macOS is different from windows installation, however prerequisite for installation is the same for all.

Jenkins can be installed using the Homebrew package manager. Homebrew formula: Jenkins-lts This is a package supported by a third party which may not be as frequently updated as packages supported by the Jenkins project directly.

Install Jenkins with Homebrew

Step 1: Install Homebrew

If you donโ€™t already have the Homebrew package manager installed, you will first need to follow the installation steps from https://brew.sh/.

You can check if Homebrew is already installed by opening a terminal window and typing:

brew โ€” version

You should get back the Homebrew version if already installed.

Step 2: Install Jenkins

Once Homebrew is installed, you can run the following command which will download and install the current Long-term support (LTS) version of Jenkins.

brew install jenkins-lts

During installation incase if you get error regarding brew version which is mentioned in the following image below

Then user command following command to upgrade your version.

brew upgrade jenkins-lts

Then after you will see that jenkins is installed

Step 3: Start the Jenkins server

The next step is to actually start the Jenkins server. You can do that with this command:

brew services start jenkins-lts

This will start the Jenkins server in a few seconds. You can check if it is properly working by visiting http://localhost:8080/

Step 4: Get the installation password

To get the password needed to run the installation process, just check the content of the file mentioned on the screen

Now to get the password from the above location using the following command in the terminal and copy that path URL.

sudo cat โ€œyour Jenkins path which you get in unlock Jenkinsโ€

Once you enter into the terminal after adding this command you will get your password copy paste and unlock your Jenkins.

How to Configure Jenkins

Once you have installed Jenkins in any of the ways presented, it is time to do its initial configuration in order to get started with Jenkins.

Step 1: Install plugins

Jenkins is composed of multiple components called plugins. The next step asks you which plugins you would like to install. Just install the suggested plugins. Donโ€™t worry about this โ€“ you can easily add or remove plugins later. Just install the suggested plugins.

Step 2: Create a Jenkins User

The next step is to create a Jenkins admin user. Make sure you write down the username and password as you will need them later.

Step 3: Configure the Jenkins URL

The final step is to configure the URL for the Jenkins server. This would be prefilled for you. So all you need to do is to click โ€œSave and continueโ€œ.

Click on โ€œStart using Jenkinsโ€ button.

Soon the server will be configured and ready for action.

Starting and stopping Jenkins in MAC OS

To stop the Jenkins server, open any terminal window and enter the command:

brew services stop jenkins-lts

To start the Jenkins server again, use the command:

brew services start jenkins-lts

Rutu Shah