Jenkins is an open-source automation server widely used in the software development industry. It serves as a powerful tool for building, testing, and deploying applications. Jenkins is designed to automate various stages of the software development lifecycle, such as code compilation, testing, and continuous integration/continuous delivery (CI/CD). It provides a flexible and extensible platform that allows developers to integrate different tools, plugins, and technologies seamlessly.

This guide covers several steps that will help you to start working with Jenkins on a MacOS Machine:
* Installing Jenkins
* Starting and setting up Jenkins
* Creating a simple job
* Creating a simple pipeline
## Installing Jenkins
### Installing with Homebrew
1. If you don't have Homebrew installed already, run:
`'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'` in your terminal. For more references on installation, visit the [official guide](https://brew.sh/).
2. Now that you have Homebrew, run: `brew install jenkins-lts`. This command will download and install Jenkins on your macOS.
### Using official installer
Alternatively, you can use the official Jenkins installer:
1. Download Jenkins: Visit the Jenkins website (https://www.jenkins.io/) and go to the Downloads page. Click on the macOS package to download the Jenkins installer for macOS.
2. Run the Installer: Once the download is complete, locate the downloaded installer file (usually a .pkg file) and double-click it to start the installation process. Follow the instructions provided by the installer.
3. Grant Permissions: During the installation, macOS may display a security prompt asking for permission to install software from an unidentified developer. Click "Open" to grant permission and proceed with the installation.
4. Complete the Installation: Follow the prompts from the installer to complete the installation process. Once the installation is finished, Jenkins should be installed on your macOS.
## Initial setup
Once installed, you can start Jenkins via `brew services start jenkins`. When it has started, you can go to http://localhost:8080 in your browser to access the Jenkins web interface. It may take a while to load, and when it does, you will be met with this page:

To find the administrator password, you can run:
`sudo cat /usr/local/var/jenkins/secrets/initialAdminPassword`.
Then, enter the password you receive, and you will be taken to the next step:

For now, you can simply install suggested plugins and click through the prompts until you get here:

It is recommended to create this user instead of skipping the stage for safety and convenience.
The final installation screen confirms the URL that will be used to access the Jenkins instance:

As this tutorial covers local jobs and pipelines anyway, click **Save and Finish**.
## Creating a simple job
Let’s create a Freestyle job that runs echo "Hello World".
1. Click on New Item on the top left of the screen. Call the item “hello-world”, and select Freestyle project. Then click OK.

2. This will now take us to a screen to configure the job.
We will leave everything as default, except the the Build section. Scroll down to the Build section. Click on the Add Build Step drop down, and select Execute shell.

This will present us with a text box we can enter echo "Hello World".

3. Now we are on the Job page, click Build Now. After a few seconds, you should see an item appear in the Build History panel on the left hand side. If all went well, you should see a blue ball icon with a #1 link next to it.

Click on the blue ball to see the console output of your build. You should see something similar to this:

Congrats on completing your first job! 🎉
## Creating a simple pipeline
Now, imagine that you have two jobs that you need to run simultaneously, and then a third one to run once they're finished. To do that, you need a Jenkins Pipeline.
In order to create one, go back to the main page and create a new item. Name it something like 'pipeline-test' and select 'Pipeline':

Leave eveyrthing as default and scroll down to the 'Pipeline script' window:

For now, let's just run 3 echoes, with the third one waiting for the first two to complete. To do that, you can use:
```
pipeline {
agent any
stages {
stage('Parallel Stages') {
parallel {
stage('Echo 1') {
steps {
sh 'echo "Wait until this completes!"'
}
}
stage('Echo 2') {
steps {
sh 'echo "Wait for this one, too!"'
}
}
}
}
stage('Echo 3') {
steps {
sh 'echo "All done!"'
}
}
}
}
```
Input this code into the 'Pipeline script' and click 'Save'. To learn more about writing pipelines as code, visit the [official documentation page](https://www.jenkins.io/doc/book/pipeline/syntax/).
Now, use the 'Build now' option the same as before, click on '#1' when it finishes, and you will see something like this:

Now, you have completed your very first Jenkins pipeline! Great job! 🥳
### Useful info
To find more information about working with Jenkins, you can always read the full documentation at https://www.jenkins.io/doc/
If you are using Windows, you can use the following guide: [гайд Санжара]