Skip to content

Instantly share code, notes, and snippets.

Last active Apr 26, 2020
What would you like to do?
My development environment setup

Prepare by switching out of bash from Homebrew:

chsh -s /bin/zsh

To clean my system and reinstall Homebrew:

rm -rf ~/.local && mkdir ~/.local
rm -rf ~/Library/Caches/pip
rm -rf ~/.pyenv
rm -rf ~/.yarn
rm -rf ~/.config/yarn
rm -rf ~/.nvm && mkdir ~/.nvm
/usr/bin/ruby -e "$(curl -fsSL"
/usr/bin/ruby -e "$(curl -fsSL"

Then I run brew doctor and resolve any issues that it finds.

On fresh OS installs, I usually need to run:

xcode-select --install

Once all is good, I install some base packages:

brew install git zsh go hub yarn nvm direnv
brew tap homebrew/command-not-found
brew install pyenv

There is no technical reason for the grouping. I like the logical grouping.

Get Homebrew bash setup by ensuring /usr/local/bin/zsh is in /etc/shells then run:

chsh -s /usr/local/bin/zsh


pyenv install 3.7.0 && pyenv install 2.7.15
pyenv global 3.7.0 2.7.15

[.bashrc] To initialize pyenv:

if which pyenv > /dev/null; then
    eval "$(pyenv init -)";

At this point I will usually kill and start it up to ensure my shell environment is clean and using things from my new /usr/local install.

I use pipsi to handle system-level Python packages that want to expose commands for me:

pip install pipsi
pipsi install httpie
pipsi install slack-cli
pipsi install pipenv
pipsi install coreapi-cli

Make sure to add ~/.local/bin to your PATH.


curl -Lo minikube && chmod +x minikube && sudo mv minikube /usr/local/bin/


(export dest=$HOME/.local/bin ; curl -s > $dest/ec && chmod +x $dest/ec)

Finally, here is a running list of software I install on my machine:

brew install redis watch caddy ack awscli coreutils curl dnsmasq elasticsearch gnu-tar gpg-agent hugo ipfs jq mercurial mongodb moreutils netcat pinentry pv socat wget xz neovim

Update pipenv:

~/.local/venvs/pipenv/bin/pip install --upgrade pipenv



use_nvm() {
    local node_version=$1
    if [[ -e $nvm_sh ]]; then
        source $nvm_sh
        nvm use $node_version

use_pyenv() {
    # because each python version is prepended to the PATH, add them in reverse order
    for ((j = $#; j >= 1; j--)); do
        local python_version=${!j}
        local pyenv_python=$(pyenv root)/versions/${python_version}/bin/python
        if [[ ! -x "$pyenv_python" ]]; then
        log_error "Error: $pyenv_python can't be executed."
        return 1
        unset PYTHONHOME
        local ve=$($pyenv_python -c "import pkgutil; print('venv' if pkgutil.find_loader('venv') else ('virtualenv' if pkgutil.find_loader('virtualenv') else ''))")
        case $ve in
            export VIRTUAL_ENV
            if [[ ! -d $VIRTUAL_ENV ]]; then
            $pyenv_python -m venv "$VIRTUAL_ENV"
            PATH_add "$VIRTUAL_ENV"/bin
            layout_python "$pyenv_python"
            log_error "Error: neither venv nor virtualenv are available to ${pyenv_python}."
            return 1
        # e.g. Given "use pyenv 3.6.9 2.7.16", PYENV_VERSION becomes "3.6.9:2.7.16"
        [[ -z "$PYENV_VERSION" ]] && PYENV_VERSION=$python_version || PYENV_VERSION="${python_version}:$PYENV_VERSION"
    export PYENV_VERSION
Copy link

paltman commented Oct 20, 2014

Thanks, @brosner. This was very helpful. Some notes and links about my setup that leans heavily on this is at:

Copy link

tardate commented Nov 5, 2014

@brosner, thanks for sharing the notes. I'm curious how you got elasticsearch installed without noting any issues like elastic/elasticsearch#6440 Did you somehow end up with Java 7 installed instead of 8?

I'm trying to decide what to do next to resolve a jdk/elasticsearch showdown:

$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

$ brew install elasticsearch
elasticsearch: Java 1.7 is required to install this formula.
You can install Java from:
Make sure you install both the JRE and JDK.
Error: An unsatisfied requirement failed this build.

Postscript: doh, just realised you didn't specifically say this setup script was for Yosemite, so that may be why you didn't have any issues with elasticsearch.

On the elasticsearch front, seems no big deal. elasticsearch 1.4 runs fine with java 8 & 10.10. It's just that the homebrew elasticsearch formula still needs updating to 1.4.

Copy link

brosner commented Nov 17, 2014

@tardate this script was built on Yosemite. I did not notice any issues with installing it. Since I had done this a while ago, I am afraid I can't provide too many details. Thanks for pointing out the bug report. I'll keep this in mind if I redo things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment