Last active
January 11, 2019 13:32
-
-
Save fwal/171665a94131aac134d7 to your computer and use it in GitHub Desktop.
My setup script for new macs
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 | |
# PUBLIC DOMAIN | |
# | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit | |
# of the public at large and to the detriment of our heirs and | |
# successors. We intend this dedication to be an overt act of | |
# relinquishment in perpetuity of all present and future rights to this | |
# software under copyright law. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# For more information, please refer to <http://unlicense.org> | |
# Prompt the user | |
function prompt { | |
while true; do | |
read -p "β $1 is not installed. Do you wish to install it? [y/n]:" yn | |
case $yn in | |
[Yy]* ) return 1;; | |
[Nn]* ) return 0;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done | |
} | |
# Check for command-line program | |
function program { | |
command -v $1 >/dev/null 2>&1 || { | |
if prompt "$2" $1; | |
then echo "π $2" && echo "" && return 0; | |
else echo "π¦ Installing $2..." && $3; | |
fi | |
} | |
echo "π $2" | |
echo "" | |
} | |
# Check for app | |
function app { | |
if [ ! -d "/Applications/$1" ]; then | |
if prompt "$2" $1; | |
then echo "π $2" && echo "" && return 0; | |
else echo "π¦ Installing $2..." && $3; | |
fi | |
fi | |
echo "π $2" | |
echo "" | |
} | |
echo "---" | |
echo "Yell-o! Let's get this mac up and running, shall we?" | |
echo "---" | |
# -- BEGIN CONFIG -- | |
program brew "Homebrew" "/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"" | |
app iTerm.app "iTerm" "brew cask install iterm2" | |
app Alfred\ 3.app "Alfred 3" "brew cask install alfred" | |
program zsh "zsh" "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)\"" | |
# -- END CONFIG -- | |
echo "---" | |
echo "All done! See you next time! πΉ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Protip: copy the link to the raw file and run with
To run this exact file use the following