Mac developers have access to AppleScript, a language designed for simple inter-app communication. Apple's ScriptEditor IDE exports these scripts to executables, which we use to automate all kinds of things. In particular though, the tedious tasks of opening up a set of Terminal windows and configuring development environments at the start of a session.

Here's an example AppleScript that boots a local development stack: a Homestead server and an Angular frontend.

tell application "Terminal"
	
	# Backend 
	set currentTab to do script ("cd ~/Web/Homestead;vagrant up;")
	delay 15
	do script ("vagrant ssh;") in currentTab
	delay 5
	do script ("cd Sites/cool-project-api") in currentTab
	
	# Frontend	
	do script ("cd ~/Web/Sites/cool-angular-project;ng serve;")
	
end tell

Here we tell Terminal to:

  • Start Vagrant and wait while a virtual machine spins up.
  • Log into the virtual server and navigate to an API project's folder, ready to run server-side dev commands.
  • Create another Terminal window, but this time navigate to a front end project and serve an Angular web app.

Having a script like this bundled up as an app, let's us boot our development environment into action with a swift double-tap before the kettle's even boiled.

HAPPY CODING!