Skip to content

A bash script to setup a mac for development, using the most common tools used at the Telegraph, while still permitting user customisation

License

Notifications You must be signed in to change notification settings

telegraph/telegraph-engineer-laptop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laptop development setup script

Sets up a new Mac for development, quickly using common tools/apps used at the Telegraph specifically targeting Apple M1, but should work on an Apple Intel machine

macOS does not include a native commandline tool to allow installing of packages. There are many third party tools that serve this purpose, and this script makes use of homebrew. This allows for setting up the machine to a common spec, while allowing the individual dev to customise the machine for their own purposes.

Individual customisations should be added to the {USER}.local file as described below.

CAUTION

WORK IN PROGRESS!!!!
Please review and contribute - PRs welcome.

Laptop

Telegraph-engineer-laptop is a script to set up an macOS laptop/desktop for web and mobile development.

It can (hopefully) be run multiple times on the same machine safely. It installs, upgrades, or skips packages based on what is already installed on the machine.

Note

  • This script must be run under the developers account and not the TMG admin account as customisations are based on the developer "user" setup on the machine

  • Developers requiring XCode must install XCode from the App store, which requires logging in to the App store

Important scripts and files -

  • bin/*.sh: Scripts that will be run, depending on OS and can be used for customising your build
  • **config/settings: Configuration for github, and your machine (assuming is has not been setup by yourself)

Remember

  • PLEASE!! Look over the scripts before running - you might not like the affects
  • Use as is if you find this suitable, otherwise customise as needed.

Installation

Clone the repo to a location on your machine

git clone git://github.com/telegraph/telegraph-engineer-laptop.git ~/laptop 
cd ~/laptop 

If you want to add some additional customisations, rename (or copy) {USER}.local to YOUR user name. ie. If your name is bob smith and your domain name to login to your laptop is bobs, rename {USER}.local to bobs.local

  mv {USER}.local bobs.local
  • Edit the config/settings file to add your github credentials. If your machine has not been cloned by your systems admin, and you want to use this to setup your machine, uncomment the machine settings and edit to your liking
  • Please read this script and make sure you like what it does. Comment out anything in the newly named file that you do not like/understand/want to change
  • This script references a Brewfile.local that YOU should edit to suit yourself

Run the main script (make sure you read it first). If you have a customisation script and have named it correctly (ie bobs.local), it will run that.

  ./bootstrap
  1. bootstrap - this will setup the default applications needed by most developers, using homebrew
  2. {USER}.local - this is where you add your customisations
    • Note - You do not need to add your own customisations.
  3. config/Brewfile.local - this is where you add brews for apps you want installed

Please pay attention when running the scripts - you will be prompted for

  • your root credentials - these are needed to install some components
  • your Git credentials

Requirements

Currently supported and tested on:

  • macOS bigsur (M1/intel)
  • macOS monterey (M1)

What it sets up

macOS tools:

  • Homebrew for managing operating system libraries.

Unix tools:

Amongst other tools, notable ones to consider are as follows

  • coreutils GNU File, Shell, and Text utilities - as the mac ones are a little out of date
  • findutils Collection of GNU find, xargs, and locate
  • moreutils Collection of tools that nobody wrote when UNIX was young (seems useful)
  • Git for version control
  • jq Commandline JSON processor
  • OpenSSL for Transport Layer Security (TLS)

Git and GitHub tools:

Programming languages, package managers, and configuration:

  • golang: Golang - Google's Go language, used by Docker
  • Python3: Python 3 - the latest version

Development tools, IDEs and text editors

  • Docker CE: Docker community edition (for Mac) for running containers
  • google-cloud-sdk: Command line tools for interacting with Google Cloud (latest version)
  • Intellij Professional Edition: Capable and Ergonomic IDE for web and enterprise development (requires a licence)
  • iterm2: Terminal replacement for mac. Some like it, some dont
  • Postman: Complete toolchain for API developers and testers
  • Slack: Communication tool
  • Spectacle: Move and resize windows with customisable keyboard shortcuts
  • Visual Studio Code: Popular general purpose, customisable, open source editor (from Microsoft)

Customize via ~/{USER}.local

Your ~/{USER}.local is run at the end of the Laptop script. Remember to rename/copy {USER}.local to YOUR username.local (ie bobs.local) Put your customizations there, and refer to bin/. for useful scripts that can be included to enhance your customisation Refer to {USER}.local for examples, most "brews" have been commented out.

Notes:

  • The script sets up oh_my_zsh as the shell, which switches to the new shell and leave the script running in the background. I have not figured out how to prevent this. When oh_my_zsh is setup, please type exit and allow the background processing to continue/finish
  • Write your customizations such that they can be run safely more than once. See the bootstrap script for examples.

The example file provides the following

  • ASDF for managing programming language versions * Java: JDK 8/11 from Azul Zulu as this has ARM64 versions for the M1 - managed by asdf * Maven: latest version of Maven * Node.js and NPM, for running apps and installing JavaScript packages * [Ruby]: for mobile development, you need Cocoapods and an updated Ruby * Yarn for managing JavaScript packages
  • Zsh as your shell

It should take about 90-120 minutes to install (depends on your machine and internet connection).

To Do Improvements

  1. Change the install to require curl to install the basic script rather than requiring git. This would require a re-run to include customisations if the user wanted them - a good reason so the script and localisations can be re-run safely.
  2. Add some CI and testing - this cannot be run in a Docker container as it is mac specific. Most testing has been done in a VM on a mac
  3. Consider adding "type" specific environment. For example, have an AEM dev for AEM dev tools, one for mobile specific dev tools, etc.

Attribution and thanks

The ideas are borrowed from the following sources -

About

A bash script to setup a mac for development, using the most common tools used at the Telegraph, while still permitting user customisation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published