Skip to content

Instantly share code, notes, and snippets.

@trovster
Last active December 26, 2021 14:33
Show Gist options
  • Save trovster/5f83a742ace0539da4047900ed617833 to your computer and use it in GitHub Desktop.
Save trovster/5f83a742ace0539da4047900ed617833 to your computer and use it in GitHub Desktop.
Starting point for a script to setup development environment (MAMP)
#!/bin/sh
# chmod a+x development.sh
# General functionality
brew install git
brew install openssl
brew install node
brew install npm
brew install yarn
brew install bat
# Install PHP and composer
brew install [email protected]
brew install composer
# Configure Database
brew install mariadb # or mysql
brew services start mariadb # or mysql
mysql_secure_installation
echo '[mysqld]' >> /usr/local/etc/my.cnf
echo '#sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # Default for MySQL 5.7' >> /usr/local/etc/my.cnf
echo 'sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' >> /usr/local/etc/my.cnf
echo '[client]' >> /usr/local/etc/my.cnf
echo 'user=root' >> /usr/local/etc/my.cnf
echo 'password=root' >> /usr/local/etc/my.cnf
# Config GIT
git config --global user.name "Firstname Lastname"
git config --global user.email [email protected]
git config --global core.editor mate
# Setup Valet
composer global require laravel/valet
valet install
cd ~/Sites/xxx && valet park xxx
# Configure DNS
brew install dnsmasq
echo 'address=/.test/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
echo 'address=/.dev/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
echo 'address=/.localhost/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
echo 'address=/.example/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
mkdir -v /etc/resolver
bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/localhost'
bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/example'
sudo brew services start dnsmasq
# Yarn
yarn global add @vue/cli
yarn global add @vue/cli-service-global
# Redis
brew install redis
brew services start redis
# Git Config
git config --global help.autocorrect 1
git config --global alias.alias "config --get-regexp ^alias\."
git config --global alias.pushall '!git remote | xargs -L1 git push'
# Oh My ZSH, see https://gist.github.com/kevin-smets/8568070
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
brew install zsh-syntax-highlighting
sed -i -e 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' ~/.zshrc
echo 'DEFAULT_USER="trovster"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
echo 'export CLICOLOR=1' >> ~/.zshrc
echo 'export LSCOLORS=GxFxCxDxBxegedabagaced' >> ~/.zshrc
echo 'alias zshconfig="mate ~/.zshrc"' ~/.zshrc
echo 'alias ohmyzsh="mate ~/.oh-my-zsh"' ~/.zshrc
echo 'alias brewup="brew update; brew upgrade; brew prune; brew cleanup; brew doctor"' ~/.zshrc
echo 'alias ls="ls -la -h -Gp -F"' ~/.zshrc
echo 'alias grep="grep -n --color"' ~/.zshrc
echo 'alias ping="ping -c 5"' ~/.zshrc
echo 'alias cls="clear"' ~/.zshrc
echo 'alias bat="cat"' ~/.zshrc
echo 'source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' ~/.zshrc
# Information
# https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
# https://gist.github.com/kevin-smets/8568070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment