Self executing script v.1. Please read through script.
$ sh ./init.sh
Assumes this is on a fresh install of Yosemite. If you already have an environment setup, dont run the init.sh script, rather comb through this and cherry pick. Hopefully you're not using mamp or the like.
All references to subl
is for opening files within the Sublime Text editor, if you haven't heard of it, no worries, this setup will install it for you and set up an alias to use it with.
Make sure your bash scripts have had chmod +x
ran on them; e.g. chmod +x script.sh
, making the file executable by everyone.
Mac Dev Env Setup consists of:
homebrew
php 5.6
update mac unix tools
correct paths
git
ruby
mysql/mariadb
bash/zsh
node
nginx
composer
bower
bundler
grunt
gulp
cask - pretty much all your apps
mackup - keep your app settings in sync. wHAT?! word.
SublimeText3 / Chrome extensions
iTerm settings
-
system pref
- change name of computer
- mouse/trackpad settings
- hotspots
-
software updates
- make sure youve updated everything.
-
xcode dev tools:
$ xcode-select --install
- get xcode
- install dev tools
$ curl http://xquartz-dl.macosforge.org/SL/XQuartz-2.7.7.dmg -o /tmp/XQuartz.dmg
$ open /tmp/XQuartz.dmg
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
$ brew doctor
$ brew update
$ brew upgrade
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php # theres also: brew tap homebrew/php
$ brew install php56
$ brew install imagemagick
-
Install GNU core utilities (those that come with OS X are outdated)
$ brew install coreutils
-
Install GNU "find", "locate", "updatedb", and "xargs", g-prefixed
$ brew install findutils
$ brew install bash
$ brew install homebrew/dupes/grep
$ echo export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" >> ~/.bash_profile
$ brew cleanup
$ brew install zsh
$ sudo mv /etc/zshenv /etc/zprofile
$ cat /etc/shells | grep zsh || which zsh | sudo tee -a /etc/shells
$ chsh -s $(which zsh)
$ echo 'export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"' >> ~/.bash_profile && . ~/.bash_profile
$ echo 'export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"' >> ~/.zshrc && . ~/.zshrc
$ mkdir -p ~/Library/LaunchAgents
# note below, path version might be different
$ cp /usr/local/Cellar/php56/5.6.2/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
$ brew install mysql
$ brew unlink mysql
$ brew info mariadb # Verify MariaDB Version in Homebrew Repo
$ brew install mariadb # Install MariaDB
# mysql setup auto start and start the database
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# Run the Database Installer
$ unset TMPDIR
$ cd /usr/local/Cellar/mariadb/{VERSION}
$ mysql_install_db
$ mysql.server start # Start MariaDB
$ mysql_secure_installation # Secure the Installation
$ mysql -u root -p # Connect to MariaDB
$ brew install git
# Write settings to ~/.gitconfig
$ git config --global user.name '{YOUR NAME}'
$ git config --global user.email {YOUR EMAIL}
# a global git ignore file:
$ git config --global core.excludesfile '~/.gitignore'
$ echo '.DS_Store' >> ~/.gitignore
# use keychain for storing passwords
$ git config --global credential.helper osxkeychain
# you might not see colors without this
$ git config --global color.ui true
# more useful settings: https://github.com/glebm/dotfiles/blob/master/.gitconfig
# ssh keys - probably can skip this since github app auto adds it for you which is nice
$ ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist
$ ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label
$ eval "$(ssh-agent -s)" # start the ssh-agent in the background
$ ssh-add ~/.ssh/id_rsa
$ pbcopy < ~/.ssh/id_rsa.pub # Copies the contents of the id_rsa.pub file to your clipboard to paste in github or w/e
$ curl -L https://get.rvm.io | bash -s stable --ruby
$ brew update && brew upgrade
$ rvm reinstall 2.1.3 --disable-binary
$ brew update
$ brew install node
$ brew update
$ brew install composer
$ npm install -g bower
$ gem install bundler
# now you can use guard within projects
$ npm install -g grunt-cli
$ npm install --global gulp
$ brew install caskroom/cask/brew-cask
// If you want to install beta versions of things like Chrome Canary or Sublime Text 3,
$ brew tap caskroom/versions
$ brew cask install google-chrome # per app
$ brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup # when done
// fonts
$ brew tap caskroom/fonts
// apps
# bash script to install apps -> apps.sh
$ chmod u+x apps.sh # make it executable
$ apps.sh # run it
$ cd ~
$ curl -O https://raw.githubusercontent.com/nicolashery/mac-dev-setup/master/.bash_profile
$ curl -O https://raw.githubusercontent.com/nicolashery/mac-dev-setup/master/.bash_prompt
$ curl -O https://raw.githubusercontent.com/nicolashery/mac-dev-setup/master/.aliases
- edit this cookie
- page speed insights
- yslow
- sway keys
- adblocker
- eye dropper
- panda
- onetab
- hola
- Chrome launcher app
- ctrl+` # opens console in sublime, paste below into console.
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
- theme-default
- brogrammer
- sidebar-enhnacemnets
- sidebar-folders
- tabs-extra
- alignment
- codekit (.kit)
- emmet
- angularjs
- sass
- scss
- docblocker
- editorconfig
- html-css-js-prettify
- js hint
- move tab
- origami
- markdown
- movetab
- unsplash
- wordpress
- sublimecodeintel
- jekyll
- trimmer
- syncedSidebar
$ brew install mackup
$ mackup backup
In Yosemite, Apache 2.4.9 is installed. We just have to use the command line to start and stop it.
One change compared to 2.2.x worth noting is that we now need the Require all granted directive in our virtual host definitions in place of Allow from all.
cd /etc/apache2
subl /etc/apache2/httpd.conf
Within the httpd.conf:
-
To enable PHP and rewriting in Apache, remove the leading # from these two lines:
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so #LoadModule php5_module libexec/apache2/libphp5.so # Include /private/etc/apache2/extra/httpd-vhosts.conf
-
Update yur file's Apache User/Group from
_www
to your{username}
andstaff
at around line 181-182. -
At around line 236, you'll find the DocumentRoot and
<Directory "/Library/WebServer/Documents">
. Update both to:/Users/{username}/Localhost
-
Also, within
<Directory>
, updateAllowOverride None
toAllowOverride All
so that .htaccess files will work as well asOptions FollowSymLinks Multiviews
toOptions FollowSymLinks Multiviews Indexes
so that we can view directory listings. -
Create a {username}.conf
<Directory "/Users/admin/Localhost/"> AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted </Directory>
Restart Apache: sudo apachectl restart
Give yourself permissions to the /Users/{username}/Localhost/ folder using these cli commands:
sudo chgrp staff /Users/{username}/Localhost
sudo chmod g+rws /Users/{username}/Localhost
sudo chmod g+rw /Users/{username}/Localhost/*
or otherwise
sudo chmod -R g+w {path}
.
Create a new file called info.php with inside your new document root; e.g. /Users/{username}/Localhost/.
Use your browser to navigate to localhost/info.php
and check your PHP version, as well as anything else you might need to reference in the future.
Use Ghosts when creating new projects in conjuncture with this setup, and have a beer cuz you just became a fly ass mother fucker. A one liner to reference,
bash <(curl -s https://raw.githubusercontent.com/kiriaze/ghosts/master/ghosts.sh)