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 https://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/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 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)
$ chsh -s /bin/bash
$ 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.32_8/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
# if mysql_install_db gives you errors and such, possible conflicting and multiple "mysqld" processes could be causing the sql server instance not to launch.
# open up activity monitor and search for mysqld, and quit those processes
# then try to start up mariadb with the code below
$ mysql.server start # Start MariaDB
$ mysql_secure_installation # Secure the Installation
$ mysql -u root -p # Connect to MariaDB
mysql issues on 10.5.5, reference this link https://stackoverflow.com/questions/34345726/brew-install-mysql-on-mac-os-el-capitan
SequelPro is installed via apps.sh if you're running the init.sh script with a few other apps. To use with MariaDB/MySql, add new Favorite in SequelPro sidebar, and set the host to 127.0.0.1 with the username 'root' and whatever password you set above in the MariaDB setup. Test connection, and save it. Now you can easily connect to all your local databases!
$ 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 "[email protected]" # 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.4.1 --disable-binary
$ brew update
$ brew install node
$ brew update
$ brew install composer
$ npm install -g bower
$ brew install yarn
$ gem install bundler
# now you can use guard within projects
with npm:
$ npm install -g grunt-cli
with yarn:
$ yarn global add grunt-cli
$ npm install --global gulp
or
$ yarn global add 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 = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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( 'https://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 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$(whoami)
andstaff
at around line 181-182. -
At around line 236, you'll find the DocumentRoot and
<Directory "/Library/WebServer/Documents">
. Update both to:/Users/$(whoami)/Localhost
or whichever destination you prefer. -
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 $(whoami).conf within the etc/apache2/users/ directory.
<Directory "/Users/$(whoami)/Localhost/"> AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted </Directory>
-
Give yourself permissions to the /Users/$(whoami)/Localhost/ folder using these cli commands:
sudo chgrp staff /Users/$(whoami)/Localhost sudo chmod g+rws /Users/$(whoami)/Localhost sudo chmod g+rw /Users/$(whoami)/Localhost/* // or otherwise specifically...but the above should handle anything added from there on out sudo chmod -R g+w {path}
-
Remove the content ( if you want ) from /etc/apache2/extra/httpd-vhosts.conf and add the code below before everything else
NameVirtualHost *:80
Followed by an example virtual host that points to the root of your web project directory e.g. Localhost
<VirtualHost *:80> DocumentRoot "/Users/kiriaze/Localhost" </VirtualHost>
-
Restart Apache:
sudo apachectl restart
-
Create a new file called info.php with inside your new document root; e.g. /Users/$(whoami)/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.
-
The init.sh script also installs a few other things such as: adobe-creative-cloud, MongoDB, Reddis, PostgreSQL - and you can setup your git global creds from the script as well.
-
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 below:
bash <(curl -s https://raw.githubusercontent.com/kiriaze/ghosts/master/ghosts.sh)
Include usage of MongoDB, Reddis, PostgreSQL.
Consider dot files or a workaround for symlinking ( although osx deletes it on upgrade ) the httpd.conf file and others for local setup to prevent overwriting on OS upgrades - like el capitain..