Last Updated: October 30, 2021
·
1.749K
· shrikeh

New Macbook Pro? Get it ready for PHP 5.4

I recently had to rebuild a Mac from scratch for PHP development, here are some (possibly) useful commands that might make your life easier if you would like to do the same. Use common sense and don't just copy-paste this onto your command line! You may also want to set up a sudo session (sudo -i) for this if in a hurry.

make all hidden files visible

defaults write com.apple.Finder AppleShowAllFiles YES

disable xcode license warning

sudo xcodebuild -license 

get Homebrew

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

Check it works

brew doctor

Get git

brew install git 

get rvm

curl -L https://get.rvm.io | bash -s stable --ruby
rvm get head
brew update
brew tap homebrew/dupes
brew install libksba
brew install autoconf automake apple-gcc42
rvm pkg install openssl
rvm install 1.9.3 
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
rvm use 1.9.3 --default

Get some useful tools

brew tap josegonzalez/homebrew-php
brew install bash-completion zsh wget nginx php54 php54imagick redis python phpsh

Get oh-my-zsh

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

Cleanup brew

brew update && brew upgrade && brew cleanup

Get bundler

gem install bundler rubygems-bundler && gem regenerate_binstubs

Gem installs: guard for phpUnit automation

gem install cucumber ruby_gntp guard guard-phpunit guard-phpcs guard-ctags-composer guard-less guard-redis terminal-notifier-guard

Set up composer globally

curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

pecl libs of use

pecl install xhprof xdebug apc

pear config-set auto_discover 1
pear upgrade PEAR

PHPUnit

pear install pear.phpunit.de/PHPUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHPUnit_Story
pear install phpunit/PHPUnit_TestListener_DBUS
pear install phpunit/PHPUnit_TestListener_XHProf
pear install phpunit/PHPUnit_TicketListener_GitHub

Behat, if you prefer it over Cucumber

pear channel-discover pear.symfony.com
pear channel-discover pear.behat.org
pear install behat/behat

phpmd

pear channel-discover pear.phpmd.org
pear channel-discover pear.pdepend.org
pear install --alldeps phpmd/PHP_PMD

codesniffer

pear install PHP_CodeSniffer

3 Responses
Add your response

Solid stuff Barney. Thanks for publishing this.

over 1 year ago ·

Instead of installing PHP locally on your machine, I'd recommend setting up a virtual machine, using for instance Vagrant.

over 1 year ago ·

I regularly use Vagrant, however many IDEs require a local PHP installation to use.

over 1 year ago ·