Follow these steps to add a space to your Dock on MacOS:
Open Terminal by searching for Terminal in Spotlight. You can do this by pressing Cmd + Space
and typing "Terminal", then pressing Enter.
Copy the following command and paste it into Terminal:
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
Press Return after pasting the command.
Now, execute the following command to restart the Dock and apply the changes:
killall Dock
If you want to add more spaces, simply repeat steps 2 and 3. Each time you execute the commands, a new space will be added to your Dock.
To move the space, click and drag it to your desired location on your Dock, just like you would do with an application icon.
If you decide you no longer want the space, click and drag it out of the Dock, similar to how you would remove an application from the Dock.
Remember, these commands are for adding spaces to the left side of the Dock (where applications are). If you want to add spaces to the right side of the Dock (where folders and the Trash are), use persistent-others
instead of persistent-apps
in the commands.