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 https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
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
Python:
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 -)";
fi
At this point I will usually kill Terminal.app 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
.
minikube:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
ec:
(export dest=$HOME/.local/bin ; curl -s https://storage.googleapis.com/ec-cli/ec-v0.8.0_darwin-amd64 > $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
Extra
~/.config/direnv/direnvrc
:
use_nvm() {
local node_version=$1
nvm_sh=~/.nvm/nvm.sh
if [[ -e $nvm_sh ]]; then
source $nvm_sh
nvm use $node_version
fi
}
use_pyenv() {
unset PYENV_VERSION
# 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
fi
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
"venv")
VIRTUAL_ENV=$(direnv_layout_dir)/python-$python_version
export VIRTUAL_ENV
if [[ ! -d $VIRTUAL_ENV ]]; then
$pyenv_python -m venv "$VIRTUAL_ENV"
fi
PATH_add "$VIRTUAL_ENV"/bin
;;
"virtualenv")
layout_python "$pyenv_python"
;;
*)
log_error "Error: neither venv nor virtualenv are available to ${pyenv_python}."
return 1
;;
esac
# 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"
done
export PYENV_VERSION
}
@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:
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.