Setting up your DEV machine in ONE script
Tags: softwareengineering, productivity, softwaredevelopment, programming
Published: 2021-05-22 20:33:27

---
title: Setting up your DEV machine in ONE script
published: true
date: 2020-04-03 00:37:01 UTC
tags: softwareengineering,productivity,softwaredevelopment,programming
canonical_url: 
---

A new computer is great 💻🎉 — It’s a clean slate. It’s snappy. It’s great… but it is missing all the tools I rely on every day! My work requires me to jump around in a variety of tools and technology stacks, hence I need to install a lot of different tools and be able to support different development environments.

![](https://cdn-images-1.medium.com/max/1024/1*BJIYUB5WjmIomJlmkz5Big.jpeg)<figcaption>Photo by Claude Piché on Unsplash</figcaption>

#### Existing package manager for CLI tools

Over time developers load command-line tools like people are buying toilet paper these days. From **maven** , via **tl;dr** , stopping at **kubectl** to **tmux**. We use all of those little nifty tools. Hence setting up a new machine can seem scary task at times, **but fear not**! For CLI tools we solved that problem long long ago with [Homebrew](https://brew.sh), or as you probably know it: _brew_   
_(The windows folks probably know_ [_Chocolatey_](https://chocolatey.org))

You can install maven for example by running: brew install maven

> Fear not! The same tool that installs CLI tools can install (almost) all our applications!

#### Brew can do more!

Homebrew uses [formulae](https://formulae.brew.sh) (or recipes) to install the tools you need in it’s _Cellar_. However, it can _tap_ into its _casks_ if you need Slack, Atom, Visual Studio Code, Java, 1Password or SourceTree — enough with the puns! It’s literally as easy as installing a CLI package.

You probably heard about casks or seen it fly by in the console.. let’s look at an example. Let’s say you want to install Firefox using brew. All you need to type is:

brew cask install firefox

Brew will update its formulae, look for the application you want to install and do it right away.

```
> brew cask install firefox
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
abcmidi cataclysm contentful-cli llvm logtalk
==> Updated Casks
google-chrome           

==> Downloading https://download-installer.cdn.mozilla.net/pub/firefox/releases/
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'firefox'.
==> Installing Cask firefox
==> Moving App 'Firefox.app' to '/Applications/Firefox.app'.
🍺 firefox was successfully installed!
```

#### Brew can’t install my application!

```
> brew cask install xcode                         
Updating Homebrew...
Error: Cask 'xcode' is unavailable: No Cask with this name exists. Did you mean “swiftformat-for-xcode”?
```

Unfortunately not every app has a recipe on homebrew. However, you may just don’t know the correct name or have spelt it incorrectly. To double-check there is a useful brew search THE-THING-I'M-LOOKING-FOR and as long as it's not cat-pictures, you'll likely be successful.

In docker’s case, it will even give you formulae’s and casks:

```
> brew search docker                                                  
==> Formulae
docker docker-machine-driver-vmware
docker-clean docker-machine-driver-vultr
docker-completion docker-machine-driver-xhyve
docker-compose docker-machine-nfs
docker-compose-completion docker-machine-parallels
docker-credential-helper docker-slim
docker-credential-helper-ecr docker-squash
docker-gen docker-swarm
docker-ls docker2aci
docker-machine dockerize
docker-machine-completion lazydocker
docker-machine-driver-hyperkit
==> Casks
docker homebrew/cask-versions/docker-edge
```

#### Ok, we get it, but where is that single script?

Ok… I’ve digressing about brew. To create a single _setup_ script, it also needs to be able to install homebrew itself. Fortunately, that’s easy and available directly from brew’s website [https://brew.sh](https://brew.sh)

I combined everything I mentioned in a sample script, that I use myself:

[![](https://cdn-images-1.medium.com/max/1024/1*13gLd10hMLVDXGO435A5ww.png)](https://gitlab.com/snippets/1961907)<figcaption>An example script for brew using formulae and casks</figcaption>

This drastically reduced the amount of time to set up my environment (about 25 min, depending on internet connection) and will make it easier in the future, if I decide to rebuild the machine.

#### Potential improvements

Here are a few improvement ideas:

- Identifying all the casks that require password and moving them at the beginning would simplify this script
- Further improve the script to do all additional customization (desktop, os settings, …)
- If you always work on the same projects, creating and executing a script with git clones and creating all the environments might be a good next step

I hope you find this article interesting and please let me know if you have any questions.

#### Resources

- Formulaes Overview: [https://formulae.brew.sh](https://formulae.brew.sh)
- Formulaes for CLI Packages: [https://formulae.brew.sh/formula/](https://formulae.brew.sh/formula/)
- Casks: [https://formulae.brew.sh/cask/](https://formulae.brew.sh/cask/)

_Originally published at_ [_Skofgar’s Blog_](https://skofgar.ch/computer-science/2020/04/setting-up-your-dev-machine-in-one/)_._

* * *