Yes. You can automate things on macOS.

Before you start, since you are a developer - make a time budget for things you need to do so you can learn how to automate. Then have fun learning things, the first is how to split up a project into small tasks.

  • https://xkcd.com/1205/ quick estimator for time budgets
  • https://xkcd.com/1319/ much of what you seek could fall under continuous maintainance / ongoing development, though...

Have you tried seeing how much time you can waste on containers? (jk, not really) it’s far superior to making lots of user accounts and you can’t just use virtual environments for such a wide ranging project.


I found your question because I am interested in the same kind of thing for my own working environments. I don't have any complete answers but I have some experiences.

One approach that I am exploring for setting up the environment is using Keyboard Maestro, which can create scripts, simple or complex, much like AppleScript but with more features, especially including being able to find button images on the screen. It's not free ($36), but I was hooked enough by the 30-day free trial to spring for it. It allows you a wide variety of triggers to invoke scripts, from opening or closing an app to plugging in a USB device to keyboard hotkeys, text typing, or mouse gestures. There's also a very helpful user forum, which is a big plus.

One way that I'm using for SWITCHING defined workspaces is the free app Current Key, which lets you define hotkeys to switch between desktop workspaces. It also has some hooks with AppleScript to identify when you have manually switched desktop spaces or to programmatically move to a new space.

I'm looking at being able to press a hotkey combination to go to a new screen and have KBM make sure that the screen is set up the way I want it to be for that project's work.

I recently went off on a sidetrack of also wanting to modify the desktop ICONS by changing the actual Desktop file, but the only way I've found to refresh that layout is by restarting Finder and that takes too much time to invoke just when moving from one workspace to another.

In looking for an alternative, I found http://www.shirt-ediss.me/clarity/ which I understood to do exactly that, give different desktop icon sets and arrangements on different desktops. After testing it, I realized that it changes the whole icon arrangement for all desktops. It can let you swap between different sets of different desktop icons, each with its own arrangement.

Clarity works by moving everything out of the Desktop folder rather than replacing the whole folder, so restarting Finder is not needed. That means it gets a new set of icons (none, or restoring the original set, or whatever) fairly quickly. However, if you've hiddent everything or are using a limited Desktop contents, you might have trouble finding things that have been put aside.

I hope these notes help you.


Just to add my 2¢...

Everything you listed can be scripted locally on your Mac, save one: keep the local environment isolated

To do that, you need separate environments. The best way to do this is with VMs, but instead of having a VM for each and every project, you can create a single base VM with a disk image in Multiattach Mode.

What this allows you to do is create a base VM with your generic setup, then have as many VMs attach to it and they will create differencing drive images so that each one will have it's customizations as you described but the disk size for each VM will only be the modifications you make. The benefit here is that you can instantly clone a machine for a new project, make all your setups and when you're ready run that project you launch that VM.

You could do this on a MacBook Pro with a few VMs, but if you have "hundreds" you probably want to invest in some server grade (or workstation class) gear or even push it out to the cloud like Azure or AWS (I'm currently testing Oracle cloud and it's horrible IMO)


Here are some specific suggestions for a subset of your asks. Note that none of these are Mac-specific, but I've used them all successfully on a Mac for years (I'm using them right now!) My gain a lot for free by being UNIX-compatible ;)

.env files

  • set env variables
  • applying git stashes with local dev connection strings

This is a technique for application configuration that avoids the need to dirty your source-controlled files just to make local configuration changes. A popular example is NPM's dotenv.

The gist is that you have one or more .env* files in your project folder that are ignored by source control. When you start your applications in development mode, they read environment variables out of these files for their configuration. This allows you to set your development configuration once without worrying about source control.

Note that this also ties in well with 12-factor apps.

SSH configuration

  • creating ssh tunnels

You can create a ~/.ssh/config file to set defaults for use cases such as this. Here's an example blog post.

I use this heavily in my job, where I have to work with a hybrid of various old, crufty systems. It's a godsend.

Docker/docker-compose

  • starting local servers

If your software fits it (which it probably will if you develop for Windows or Linux), Docker and docker-compose can be very useful for reproducing software on different environments. More generally, this technique is called "containerization." It's a very broad topic, but it's very popular these days for simplifying developer workflows. IMO, it's almost always worth the effort. If nothing else.

This can also be easily combined with .env files.