Workstation Setup
This project automates the process of setting up a new Mac OS X software development machine using simple Bash scripting. It heavily relies on homebrew.
Goals
The primary goal of this project is to give people a simple script they can run to make their Mac OS X machine prepared and standardized for working on software development projects, especially those common at VMware Tanzu Labs.
Why did we do it this way?
- A bash script is easy for users to edit locally on-the-fly for small temporary tweaks
- Everything is in one repository
- The project name is informative
- It is easy to fork and customize
- It has limited requirements:
git
andbash
available on macOS by default
Anti-goals
This project does not aim to do everything. Some examples:
- We don't install everything that your project needs. These scripts should only install generally useful things, and prefer running quickly over being complete.
- We avoid setting up and maintaining overly-custom configurations. When there is already a tool that will get us something in a conventional manner, such as Oh My Zsh, we prefer to use it instead of doing things ourselves.
Preparation
- Run the latest version of macOS unless you have a specific reason not to
- These scripts might work on previous versions, but are maintained with only the latest macOS in mind
- Install the latest stable version of Command Line Tools for Xcode
Getting this tool
Open up Terminal.app
and run the following command:
mkdir -p ~/workspace &&
cd ~/workspace &&
git clone https://github.com/pivotal/workstation-setup.git &&
cd workstation-setup
Note: This might prompt you to install the latest Xcode command line development tools. Please do so if prompted.
Using this tool
Within ~/workspace/workstation-setup
, run the following:
./setup.sh [list of optional configurations]
Examples:
# This will only install the default items
./setup.sh
# This will install the latest Java and Docker
./setup.sh java docker
Warning: this tool might overwrite existing configurations.
Items installed by default
We recommend that you look at setup.sh
to see what is automatically installed. You'll see it calls other scripts within scripts/common
, so feel free to take a look at those, too. Note that you can edit any of those files to add or remove items specific for your needs, but the goal of this project is to have sane defaults for our target audience.
Opt-In Configurations
Please look in scripts/opt-in/
for optional, opt-in configurations. Some of these are languages and associated frameworks, such as java
and golang
. Some are supporting infrastructure, such as docker
and kubernetes
. Others might be specific tools for application platforms, such as cloud-foundry
.
To install any of these, add them as arguments to $> setup.sh
. Examples:
# Common for Spring Boot development
./setup.sh java spring-boot docker
# Lots of languages
./setup.sh java ruby node golang python c
# Love those platforms!
./setup.sh golang docker kubernetes cloud-foundry terraform concourse
Analytics
The tool will send anonymous user data to our Google Analytics account, so we can see what command line arguments are popular. You can disable this:
# Remove unnecessary languages when running command
SKIP_ANALYTICS=1 ./setup.sh java ruby node golang c docker
This will also disable brew's data collection.
Having problems?
If you're having problems using the setup script, please let us know by opening an issue.
If you see errors from brew
, try running brew doctor
and include the diagnostic output in your issue submission.
Customizing
If you'd like to customize this project for a project's use:
- Fork the project
- Edit the shells scripts to your liking
- Profit
Frequently Asked Questions and Troubleshooting
Q: Can I rerun setup.sh
?
A: Yes, but with a but. While this script is not entirely idempotent, it does use homebrew's cache to skip reinstalling items, and is pretty lenient about ignoring errors when non-homebrew items get mad that they are already installed. There is no guarantee that some configurations won't be overwritten or duplicated.
Q: Should I run this with sudo
?
A: No. setup.sh
will ask you for your password take care of that for you.
Q: I'm getting permission errors such as the one below:
Error: Can't create update lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
sudo chown -R $(whoami) /usr/local/var/homebrew
A: Short answer: run the suggested command or consider the Possible Solution described below.
Longer answer: You might have multiple user profiles on your machine that are using homebrew (such as this tool) resulting in a mix of file and directory ownership under /usr/local/var/homebrew
. This should mostly be an issue with installing things, but not using the tools installed by brew
. If you switch between profiles and install tools using brew
often you might run into this a lot.
Possible Solution: Try this solution from itectec which makes homebrew's directories writable by the staff
group, which should be all admin users on your machine.
-
Note your default
umask
for later.$> umask 022
-
Set homebrew's directories to be writable by everyone in the
staff
group.umask 002 # group write permission sudo chmod -R g+w /usr/local/* # group writable sudo chgrp -R staff /usr/local/* # staff owned
-
Set your
umask
back to the default.umask 022 # or whatever you noted earlier
Q: How to I get my change into this tool?
A: Submit a PR, especially for things that are outdated or broken. But, we are being vigilant about keeping this tool lean after a history of letting many idiosyncratic changes creep in over the past few years. As stated above, you can edit the files yourself after downloading them and/or fork.