How to install Gitlab runner on Mac OS?

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Hello-tech lover, welcome to the visualizing path of programming. You know better today trends to take up-gradation in technologies and their environment around the world. Through this article, we are going to give you lessons on Gitlab runner and we will go very basic step by step and learn how to install, register, and start Gitlab runner. So, if you have no primary knowledge of that then do not worry. We will start from scratch.

What is a Gitlab runner?

Gitlab runner is used in Gitlab CI and you have not learnt yet Gitlab CI. Now, this is an open-source continuous integration service. It is included with Gitlab, is used to run jobs & send results back to Gitlab. Now, let’s see, what are the steps you have to do for setting up Gitlab runner.

How to install Gitlab runner?

Let us see, what we will do about this? You will go to Google and search for Gitlab runner. You will visit the website for Gitlab runner documentation and you will see all the documents over there. This is written in a go programming language, you can see some features like multiple jobs concurrently run. And if you will have to move down, there will be a section of install Gitlab runner. You would find every sort of documentations about Gitlab runner like how to configure, troubleshooting, etc. If you will click on the install option then there will be options like Mac for the operating system. So, you will click on the option to install Mac operating system and there you will have the steps if you want to install it manually. Then you will have to install the binary in your system and you can use that given command from there. You may copy and run it in your terminal then it will download the binary. So, you will have to give permissions from the given command. This is the first way, the second way is homebrew installation. If you will go for homebrew, there will be a website so, you will see there “the missing package manager for Mac OS” like this type of thing will be written there. To install homebrew, it is very simple so, you will have to copy that statement from there and will have to run on terminal. Then you can start using homebrew, it is a good way to install and manage packages on Mac. There will be a command so, you will have to run that on your terminal then this will install Gitlab runner on your Mac operating system. Here are some commands to install, version, start, and stop like

Brew install Gitlab –runner

Gitlab-runner –version

Brew services start GitLab –runner

Brew services stop GitLab –runner

How to register Gitlab runner?

Let us see how can we register GitLab runner? So, there you will visit the Gitlab runner documentation. You will find the registration part in that you will have a register link and from there, you would see that what are the step to register the Gitlab runner? Now, on that page, if you will scroll down then you will find all the steps for Mac OS, window OS, etc. so, you will have to run the following command Gitlab –runner register, this is the first command. You will go to your terminal and run the command Gitlab –runner register then there, they shall ask for a Gitlab-ci token for this runner. So, to get the ci token, you will log in to your Gitlab account and you will have to take tokens from Gitlab projects. You will go to your project by doing a sign-in process then you would have to go to project settings. If you will see, scroll down and you will find the setting there. If you will go to settings under that you will get CI /CD section. You will go to CI/CD then you will have a section of runner then you will expand it. You will find the setup runner manually option will be there and there will be a token of your project. You will have to do copy that from there and provide it on the terminal and you will also put tags for your Gitlab ci like ssh, ci. Then you will see registering runner…..succeeded and after this, you will have to enter the name of executors like parallels, custom, Docker-ssh, etc. you have so many executors if you want to run on Docker and some Kubernetes. If you will put simple executor shell and press enter button. Then it will show the runner registered successfully. These are the commands which you have followed.

How to start Gitlab runner?

So, if you have to start Gitlab runner then you can use these brew services start Gitlab –runner. To start Gitlab runner, if you’re not using brew then you will have all the options there like Gitlab –runner stop. You can take Gitlab –runner start if you are not using brew. Then it will be successfully started and the next step will be to check runner is activated in the project. So, you will have to check runner is activated or not, again, you will go to your Gitlab, project, and in settings CI/CD. And there you will expand the runner section, if you will scroll down then you will see your runner will be there, it is started. You can also see the name and text that you had added. So, you have seen that how to use the runner and how to do Gitlab ci? I wish, these lessons will be very helpful for you.

Related video: