Last active
May 23, 2019 17:16
-
-
Save shentonfreude/f9c63dd19eac67e0780d2d964f613ad4 to your computer and use it in GitHub Desktop.
Initial install and config of mac based on Jared Short's idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Based on ideas from shortjared/mac-idempotent-setup.sh | |
# First time takes a while; if all's installed, takes 30 seconds. | |
BREW_CASKS=( | |
alfred | |
authy | |
brave-browser # update to get DuckDuckGo | |
docker | |
dropbox | |
duet | |
#duplicati # BROKEN | |
electric-sheep # asks for sudo passwd | |
emacs | |
firefox | |
google-chrome | |
hipchat | |
#istat-menus # I bought this on AppStore, may have to continue :-( | |
iterm2 | |
slack | |
spotify | |
spectacle # need to set next/prev screen keys | |
virtualbox # asks for sudo passwd; errors? | |
visual-studio-code | |
) | |
BREW_PKGS=( | |
#curl # already in High Sierra, won't link | |
black # python code formatter | |
git-flow # not -avh version which doesn't work with Magit | |
mas # mac app store | |
nvm | |
pyenv # requires and installs Python in ~/homebrew/Celler/python/3.7.2* | |
pyenv-virtualenv | |
pyenv-virtualenvwrapper | |
pipenv # try putting after pyenv so it may not brew install python | |
readline # for python | |
syncthing # config on localhost:8384 | |
wget | |
xz | |
zlib | |
) | |
MAS_APPS=( | |
1319778037 # istat-menus | |
926036361 # lastpass | |
) | |
echo "# Installing Homebrew..." | |
which brew > /dev/null 2>&1 | |
if [ $? -eq 1 ]; then | |
#Cheat, if we don't have brew, install xcode command line utils too | |
xcode-select --install | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
else | |
brew update | |
fi | |
echo "# Installing Brew Casks..." | |
brew tap caskroom/cask # ? | |
for p in "${BREW_CASKS[@]}" | |
do | |
brew cask install $p | |
done | |
echo "# Installing Brew packages..." | |
for p in "${BREW_PKGS[@]}" | |
do | |
brew install $p | |
done | |
echo "# Starting syncthing on localhost:8384 ..." | |
brew services start syncthing | |
echo "# Installing Mac App Store apps..." | |
for p in "${MAS_APPS[@]}" | |
do | |
mas install $p | |
done | |
echo "# Brew install aws-rotate-key, aws-rotate-iam-keys" | |
brew install fullscreen/tap/aws-rotate-key # -profile P -d to delete rather than deactivate old | |
brew tap rhyeal/aws-rotate-iam-keys https://github.com/rhyeal/aws-rotate-iam-keys | |
brew install aws-rotate-iam-keys | |
# System settings | |
echo "# Setting default settings like Dark, Dock, forceclick..." | |
defaults write NSGlobalDomain KeyRepeat -int 2 # 0 is too fast, 2 is min in UI | |
defaults write NSGlobalDomain InitialKeyRepeat -int 25 # 25 is quick, 15 is very quick | |
defaults write NSGlobalDomain AppleInterfaceStyle -string Dark | |
defaults write com.apple.dock autohide -int 1 | |
defaults write com.apple.trackpad.forceClick -int 0 # disable context on hard click | |
# HOW Trackpad tap to click? | |
echo "# Remove everything from taskbar, alfred is better" | |
defaults read com.apple.dock persistent-apps | grep file-label > /dev/null 2>&1 | |
while [ $? -eq 0 ]; do | |
/usr/libexec/PlistBuddy -c "Delete persistent-apps:0" ~/Library/Preferences/com.apple.dock.plist | |
done | |
echo "# ssh configs from Syncthing and ssh control socket" | |
# TODO need to do a better job of this if .ssh already exists | |
cd ~ | |
ln -s ~/Sync/.ssh ~/.ssh | |
mkdir -p ~/.ctlssh | |
echo "# Emacs config from github and switch to git flow init for develop branch" | |
cd ~ | |
if [ -d .emacs.d -a ! -d .emacs.d/.git ] | |
then | |
mv .emacs.d .emacs.d.`date +"%Y-%m-%d_%H:%M:%S"` | |
fi | |
if [ ! -d .emacs.d ] | |
then | |
git clone git@github.com:shentonfreude/dot-emacs.git .emacs.d | |
(cd .emacs.d && git flow init --defaults) | |
fi | |
echo "# MacOS Mojave 10.14 removed headers needed to build python, reinstalling..." | |
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / | |
echo "# Setting PYENV_ROOT and PATH for pyenv and initializing..." | |
export PYENV_ROOT=${HOME}/.pyenv | |
export PATH=${PYENV_ROOT}/bin:$PATH | |
eval "$(pyenv init -)" | |
echo "# Install Pythons: 3.4.7 for AVAIL and current py2, py3" | |
if [ ! -d ~/.pyenv/versions/3.4.7 ] | |
then | |
pyenv install 3.4.7 # for AVAIL, requires zlib | |
fi | |
if [ ! -d ~/.pyenv/versions/3.7.2 ] | |
then | |
pyenv install 3.7.2 # latest py3 as of 2019-02-15 | |
fi | |
if [ ! -d ~/.pyenv/versions/2.7.15 ] | |
then | |
pyenv install 2.7.15 # latest py2 as of 2019-02-15 | |
fi | |
echo "# Python pyenv virtualenvs for tools like aws cli: py2, py3" | |
pyenv virtualenv 2.7.15 py2 | |
pyenv virtualenv 3.7.2 py3 | |
echo "# Python path order: generic py3, py2" | |
pyenv global py3 py2 | |
# TODO install aws-cli and other generic tools in py2, py3 | |
echo "# Make dir for Node virtual environments ~/.nvm" | |
mkdir -p ~/.nvm # Node virtual environment dir | |
#shell profile (private github?) | |
############################################################################### | |
# TODO | |
# V! VPN profile: can VPN but cannot get browsers to use PIV for auth. | |
# .bashrc/.bash_profile for PATH, etc | |
# Not in homebrew, manual or other install? | |
# TimeMachine | |
# afp://v-nas | |
# Cisco VPN crap | |
# MS Office | |
# PIV Card | |
# CAC works for AnyConnect VPN but browsers don't recognize it for Launchpad | |
# Don't want to automatically install for ACES-provided machines as they already have one | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment