Over the past year, I've had multiple GitHub repositories for developing pallar, and it was inconvenient to switch between them. All of the projects used Python and Django, and I found it tedious to switch to the correct folder and run the command to start the local Django service for development. So I started to figure out if I could use a single command to streamline the process, and here's what I found.


1. Create a custom script

Firstly, you need to create a script and name it Place this file in the root folder, and then you can create multiple functions within it.

$ touch

For example, you could create two functions called service1 and service2, and for each function, the terminal will navigate to the specified folder and execute the Python shell with Django.

function service1() {
    cd /Users/paul/dev/test1
    python runserver

function service2() {
    cd /Users/paul/dev/test2
    python runserver

2. Source the script

After creating the script, you need to use the source command to read and execute the script content.

$ source ~/

or you can put this command to the .bashrc or .zshrc file depend on which one you used.

3. Execute it

➜ service1
Performing system checks...

System check identified no issues (0 silenced).
March 16, 2023 - 15:27:58
Django version 3.2.15, using settings ''
Starting development server at
Quit the server with CONTROL-C.


This blog post shares how to create your own commands on a Mac. It may take some time to become familiar with your own commands, but enjoy the journey!