Skip to content

Instantly share code, notes, and snippets.

@allysonsilva
Last active April 28, 2018 14:43
Show Gist options
  • Save allysonsilva/200756b6d9f65762e0191b60cfb68bd8 to your computer and use it in GitHub Desktop.
Save allysonsilva/200756b6d9f65762e0191b60cfb68bd8 to your computer and use it in GitHub Desktop.
macOS⚡️Simple Development Environment
######
# Colors
######
GREEN='\033[0;32m'
LIGHTGREEN='\033[1;32m'
LIGHTBLUE='\033[01;34m'
NC='\033[0m'
main() {
echo
echo "${LIGHTBLUE}================================================"
echo " Mac CLI Installer"
echo "================================================${NC}\n"
if hash brew 2>/dev/null; then
echo "Homebrew is already installed!"
else
echo "Installing homebrew..."
echo "${GREEN}/usr/bin/ruby -e '\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'\n${NC}"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo
echo "Ensuring your Homebrew directory is writable..."
sudo chown -R $(whoami) /usr/local/bin
echo
echo "Installing Homebrew services..."
brew tap homebrew/services
echo
echo "Upgrading existing brews..."
brew upgrade
echo "Cleaning up your Homebrew installation..."
brew cleanup
# ======================================
brew install tree httpie
brew install vim
brew install diff-so-fancy
if [ ! -f /usr/local/bin/pv ]; then
echo "Installing pv (Pipe Viewer)..."
echo "${GREEN}brew install pv\n${NC}"
brew install pv
fi
# Default macOS: `/usr/bin/perl`
brew install perl pcre
# Default macOS: `/usr/bin/openssl`
brew install openssl
//ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
//ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
brew install openssl@1.1
brew install libssh2 pkg-config icu4c autoconf automake libev libevent
brew install boost --with-icu4c
brew install sphinx-doc readline tcl-tk xz gdbm
brew install go
# Defaut macOS: `/usr/bin/sqlite3`
brew install sqlite --with-dbstat --with-docs --with-fts --with-fts5 --with-functions --with-icu4c --with-json1 --with-secure-delete --with-session --with-soundex --with-unlock-notify
brew link sqlite --force
type -a sqlite3
# Default macOS: `/usr/bin/python`
brew install python3
# Default macOS: `/usr/bin/curl`
brew install curl --with-c-ares --with-gssapi --with-libssh2 --with-nghttp2 --with-openssl
brew install wget --with-libressl
brew install git --with-blk-sha1 --with-curl --with-gettext --with-openssl --with-pcre2 --with-perl
brew install exa fd fzf
/usr/local/opt/fzf/install
brew install libev libevent libidn2 libpng libsodium libtool libunistring libxml2 libyaml
brew install ag ripgrep
# Default macOS: `/usr/bin/ruby`
brew install ruby
if [ ! -f /usr/local/bin/sass ]; then
printf "${LIGHTGREEN}"
read -r -p "Would you like to install sass (http://sass-lang.com/)? (Yes / No)" response
case $response in
[yY][eE][sS]|[yY])
echo "Installing sass..."
echo "${GREEN}sudo gem install -n /usr/local/bin compass\n${NC}"
sudo gem install -n /usr/local/bin compass
;;
*)
;;
esac
printf "${NC}"
fi
sudo gem install sass
gem install lunchy
if ! which node > /dev/null; then
echo "Installing node..."
echo "${GREEN}brew install node\n${NC}"
brew install node --with-openssl
fi
npm install -g tldr
brew install mongodb
# To have launchd start mongodb now and restart at login:
# brew services start mongodb
# OR
# ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
#. launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
# Or, if you don't want/need a background service you can just run:
# mongod --config /usr/local/etc/mongod.conf
mongod --config /usr/local/etc/mongod.conf
brew services restart mongodb
sudo chown -R `id -un`:admin /usr/local/var/mongodb
mongod --dbpath /usr/local/var/mongodb
brew install dnsmasq --with-dnssec
# To configure dnsmasq, take the default example configuration at
# /usr/local/etc/dnsmasq.conf and edit to taste.
# To have launchd start dnsmasq now and restart at startup:
# sudo brew services start dnsmasq
brew install nginx
sudo brew services start nginx
# OpenSSL - Generate ssh key for localhost
mkdir -p $(brew --prefix)/etc/nginx/conf.d
mkdir -p $(brew --prefix)/etc/nginx/ssl
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -keyout /usr/local/etc/nginx/ssl/localhost.key -out /usr/local/etc/nginx/ssl/localhost.crt
openssl dhparam -out /usr/local/etc/nginx/ssl/dhparam.pem 4096
# Disable Apache autostart
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew install redis --with-jemalloc
# To have launchd start redis now and restart at login:
# brew services start redis
# Or, if you don't want/need a background service you can just run:
# redis-server /usr/local/etc/redis.conf
brew install mysql
# To have launchd start mysql now and restart at login:
# brew services start mysql
# Or, if you don't want/need a background service you can just run:
# mysql.server start
brew services stop mysql
brew services start mysql
mysql_secure_installation
# OR
ln -sfv /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# FreeTDS
brew install unixodbc
brew install freetds --with-unixodbc
// https://gist.github.com/Bouke/10454272
if [ ! -f /usr/local/bin/composer.phar ]; then
echo "Installing composer..."
echo "${GREEN}curl -sS https://getcomposer.org/installer | php\n${NC}"
curl -sS https://getcomposer.org/installer | php
echo "${GREEN}sudo mv composer.phar /usr/local/bin/\n${NC}"
sudo mv composer.phar /usr/local/bin/
fi
# Diversos
pip install -U Pygments
# Default macOS: `/bin/zsh`
brew install zsh --with-gdbm --with-pcre --with-unicode9
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
# For Zplug b4b4r07/emoji-cli
brew install jq --devel
brew install peco
sh -c "curl https://raw.githubusercontent.com/mrowa44/emojify/master/emojify -o /usr/local/bin/emojify && chmod +x /usr/local/bin/emojify"
if [ ! -f /usr/local/bin/imageOptim ]; then
printf "${LIGHTGREEN}"
read -r -p "Would you like to install ImageOptim to optimize images from the command line? (Yes / No)" response
case $response in
[yY][eE][sS]|[yY])
echo "Installing ImageOptim..."
echo "${GREEN}brew cask install --appdir="~/Applications" imageoptim --force\n${NC}"
brew cask install --appdir="~/Applications" imageoptim --force
echo "Installing ImageOptim-CLI (https://github.com/JamieMason/ImageOptim-CLI)..."
echo "${GREEN}npm install -g imageoptim-cli\n${NC}"
npm install -g imageoptim-cli
;;
*)
;;
esac
printf "${NC}"
fi
if [ ! -f /usr/local/bin/istats ]; then
printf "${LIGHTGREEN}"
read -r -p "Would you like to install iStats access information about your Mac temperature and fan speed? (Yes / No)" response
case $response in
[yY][eE][sS]|[yY])
echo "Installing iStats..."
echo "${GREEN}sudo gem install iStats -n/usr/local/bin\n\n${NC}"
sudo gem install iStats -n/usr/local/bin
;;
*)
;;
esac
printf "${NC}"
fi
if [ ! -f /usr/local/bin/speedtest-cli ]; then
printf "${LIGHTGREEN}"
read -r -p "Would you like to install Fast CLI to run internet speed tests from your command line (https://github.com/sindresorhus/fast-cli)? (Yes / No)" response
case $response in
[yY][eE][sS]|[yY])
echo "Installing Fast CLI (https://github.com/sindresorhus/fast-cli)..."
echo "${GREEN}npm install --global fast-cli\n${NC}"
npm install --global fast-cli
;;
*)
;;
esac
printf "${NC}"
fi
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment