How to install supervisor on MacOS. In your project, you sometimes need to use a program to manage the Schedule Tasks (Queue – Job). Supervisor is a good choice for Linux, especially Ubuntu. However, many developers use MacOS, and installing supervisors on Macs is sometimes difficult if your MacOS is using python 3.
This article provides solutions if your MacOS does not install a supervisor. I use Python 3, so i can not install a supervisor normally. I found the solution after trying a lot of methods. And now, let’s start.
Install supervisor on MacOS
First, you need to create a Python environment with Conda. Conda is a system for managing libraries as well as working environments. We can switch versions easily. Start creating Python environment 2.7
conda create -n envtestpy2 python=2.7
Terminal will ask to install Python 2.7 packages. Press y and Enter. When finished, you will see
Now you have a python 2.7 environment to install the supervisor. Perform the installation as usual.
Step 1: Active Environment
source activate envtestpy2
Step 2: Install supervisor
Successful installation, you will have supervisor.
Step 3: Configure the supervisor
View the supervisor configuration file
Here I take an example of my project. My project uses Laravel + Valet. And I have a Job update all my shop image using the Queue Job in Laravel.
I will configure the supervisor as follows:
- Create a file containing the parameters of the Job to run. Each job has only one configuration file. In this example, I created a smartseoimage-worker.conf file with the following content.
- Do not care about content inside. They are just job settings.
- Then, you include the file name at the end of the supervisor’s default config file. the supervisor’s default config file is supervisord.conf
So I successfully configured my job on the supervisor. Later, if any more jobs. Just repeat step 3.
Step 4: Run Job
Launch supervisord if no supervisord is run.
Run Job created
supervisorctl reread #update config supervisorctl start smartseoimage-worker:* #run
So you can customize your project on MacOS. Wish you a wonderful work day.