Alfred: Quick Dev. starter project : keyword & bash script

If like me you use Alfred on OSX to speed up your productivity and improve the experience of working with computers, you might have thought of creating an Alfred ‘Workflow’ to quickly create a new folder containing all the resources required to test or build a new code project. The following refers to front end development projects but you can tailor it to suit your requirements with a few alterations.

The problem:

Often times you want to quickly smash out some code to try a new CSS Framework, Javascript library or prototype an idea before going to full production. This remains a long-winded task requiring finding the relevant files, folders, scripts, dependencies, so on and so forth, copying them all to a new working directory and launching your development environment. This could be, Sublime Text, Google Chrome and Codekit for example.

Whilst I do knock out quick code sketches in jsbin, codepen or jsfiddle, at some stage I will probably want to port all that code in to my dev environment and work within the boundaries of a proper distribution workflow.

The solution:

Alfred. [It seems customary to point out they are not sponsoring me for this article nor endorsing me in anyway]

There are a number of similar vendors who offer pretty much the same thing but I found Alfred to be the easiest to use and transparent in allowing me to get on with being productive with minimal distraction.

Sometimes though setting up a task can become frustrating and complicated when all google searches result in out of date solutions that don’t completely apply and thus don’t fully work as one would like them to. After a day or so of searching and experimenting I have compiled a working solution which, in the immortal words of Steve Jobs (and then most everybody else presenting an Apple keynote) “I would love to share with you.”

The conclusion

Using Alfred productivity app on OSX to speed up the process of creating a new development project each time you want to test out ideas or quickly get coding.

Choose Alfred Preferences > Workflows (+ create new workflow) + Triggers > keyword + Outputs > Run Script

After creating your KEYWORD and adding a blank SCRIPT to the workflow :

Use the following bash script (n.b each line of code is first annotated with an explanation)

Change to [* your Working Directory] and make a new folder and open it

cd ~/Desktop && mkdir {query} && cd {query}

Copy [* your Template Directory]

cp -R ~/yourworkingdirectory/yourtemplatedirectory/ .

Open the new project in Codekit

open -a /Applications/ ~/Desktop/{query}

Open in Google Chrome using the local server URL from codekit

open -a “/Applications/Google” http://yourcomputername.local:5757/

Open the new project in Sublime Text

/Applications/Sublime\ .

Assumes the following:

  • Template Directory > Files and folders, dependencies, libraries, frameworks etc. Whatever code structure you require to build a new project.
  • Working Directory > The place on your system where you store your work.


So there you have it, a code environment up and running with a single keyword trigger. All hail speed, productivity and human ingenuity.


This article assumes some basic understanding of how to use Alfred to create workflows. If you don’t there are plenty of explanations here:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.