Apple - Auto start an application using a script

Technically, you don't need to check to see if the app is running. If it is, it will switch to it.

A very simple bash script will do this for you

#!/bin/bash

declare -a Apps=( "Safari" "Firefox" "Mail" )

for i in "${Apps[@]}"
do
  open -a  "$i"
done 

It's contains a simple array and will loop through each one and open the app if not running. You can edit the array as needed with the names of each app in quotes separated by a space.

Save the file with a name you can remember like openapps. Be sure to set the the "execute bit" chmod +x openapps and copy it to your Desktop or somewhere in your path (If it's on your Desktop, you can double click it to run).

Tags:

Bash

Mojave