Configurations and scripts for setting up a new developer Mac.
Note: These scripts currently target macOS Big Sur (11). If you need to setup a Mojave (10.14) Mac, please use the tagged release for Mojave.
The mac_setup.sh
script installs a standard developer environment
on new Mac computers, with the goal of making the machine ready to set up
consumerfinance.gov for local
development.
This includes, but is not limited to:
- Homebrew
- Up-to-date or cfgov-refresh-specific versions of several core developer tools:
- Git (replacing Apple Git)
- git-secrets hooks for ensuring you don't accidentally commit bad stuff
- pyenv and pyenv-virtualenvwrapper with Python 3.8.12
- pipx for running isolated Python applications
- nvm with the latest LTS release of Node
- Yarn with the following installed globally:
- yo
- generator-cf
- generator-node
- snyk
- Minimal dotfiles with the necessary bits for all of the above to work as expected
- Run the following command from the root of this repository
to initiate the installation:
./mac_setup.sh
. - After the script completes, run
source ~/.zshenv
to apply the changes to your current terminal session, or just close the session and open a new one.
Scripts to set up each component can also be run individually:
preflight.sh
to check network access and local configuration before proceedinghomebrew_setup.sh
to install and configure Homebrewpython_setup.sh
to install and configure our Python development environmentnode_setup.sh
to install and configure our Node development environmentgit_setup.sh
to install and configure git and git-secretsdotfiles_setup.sh
to apply our standard dotfiles
- If any dotfiles (
~/.bash_profile
,~/.bashrc
, etc.) would be overwritten, they will be backed up to~/<filename>_<date>
. - If you have anything in your
~/.git-templates/
folder and your global.gitconfig
hasinit.templateDir
value is set to that location, your files will be left in place and theinit.templateDir
will be changed to~/.git-templates/git-secrets/
.
The github_setup.sh
script has two functions:
- Ensure the
~/.gitconfig
file in your home directory has a name and email address configured so that you get credit for your commits. - Create an SSH key (if it doesn't already exist) for integration with
GitHub.com and CFPB's GitHub Enterprise instance.
- If generating an SSH key, you will be prompted to create a password for the key.
After the script completes, you will be provided with a "public key" and the following instructions for applying the key to your two GitHub accounts:
- Log into your GitHub accounts and paste this public key in the GitHub Settings website
- Directions for adding keys
The script is safe to run even if you have already
configured your .gitconfig
and/or SSH key.
In this case, the tool will simply output your existing details for your review.
Run the following command from the root of this repository: ./github_setup.sh
.