This repository has been archived by the owner on May 18, 2023. It is now read-only.
forked from thoughtbot/laptop
-
Notifications
You must be signed in to change notification settings - Fork 5
/
mac
129 lines (106 loc) · 6.05 KB
/
mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env bash
function need_sudo {
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "Your sudo password is (likely) needed in the Terminal or will be very shortly." buttons {"OK"}'
osascript -e 'tell app "Terminal" to activate'
}
[[ `diskutil coreStorage list` == 'No CoreStorage logical volume groups found' ]] && {
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "Please enable FileVault and restart, then start this process again." buttons {"OK"} default button 1'
open /System/Library/PreferencePanes/Security.prefPane
exit 1
}
type -p gcc > /dev/null || {
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "Please install XCode now.\n\n(The App Store has been opened for you.)\n\nIf you have installed XCode and still get this dialog, you will need to install the command-line tools by going to Preferences > Downloads in the XCode application." buttons {"Cancel", "OK"} default button 2'
open /Applications/App\ Store.app
echo "ERROR: Cannot find gcc. Try starting this process again."
exit 1
}
echo "Installing Homebrew, a good OS X package manager."
need_sudo
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
brew update
echo "Installing GNU userland tools."
brew install coreutils gnu-sed findutils
echo "Install GitHub-related tools."
brew install git gist hub
echo "Installing a recent version of curl and wget for HTTP requests."
brew install curl wget
echo "Installing MySQL, our standard database server."
curl -fsSL https://raw.github.com/phase2/laptop/master/conf_files/my.cnf > /tmp/my.cnf
need_sudo
sudo mv /tmp/my.cnf /etc/my.cnf
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
echo "Installing a test phpinfo.php in the new DocumentRoot."
[[ -d $HOME/htdocs ]] || {
mkdir $HOME/htdocs
echo '<?php phpinfo();' > $HOME/htdocs/phpinfo.php
}
echo "Installing Homebrew's PHP, MSSQL, MySQL and internationalization support."
brew install https://raw.github.com/josegonzalez/homebrew-php/f09dc1288d839c8d7118a431360d80cd7e9419d2/Formula/php.rb --with-mysql --with-intl
curl -fsSL https://raw.github.com/phase2/laptop/master/conf_files/httpd.conf | sed -e "s/@@USER@@/$USER/" > /tmp/httpd.conf
curl -fsSL https://raw.github.com/phase2/laptop/master/conf_files/httpd-extra-config.conf > /tmp/httpd-extra-config.conf
curl -fsSL https://raw.github.com/phase2/laptop/master/conf_files/httpd-vhosts.conf | sed -e "s/@@USER@@/$USER/" > /tmp/httpd-vhosts.conf
need_sudo
sudo mv /tmp/httpd.conf /etc/apache2/httpd.conf
sudo mv /tmp/httpd-extra-config.conf /etc/apache2/extra/httpd-extra-config.conf
sudo mv /tmp/httpd-vhosts.conf /etc/apache2/extra/httpd-vhosts.conf
chmod -R ug+w /usr/local/Cellar/php/5.3.10/lib/php
pear config-set php_ini /usr/local/etc/php.ini
echo "Installing PHP extensions and a default configuration."
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/apc-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/memcached-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/imagick-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/pcntl-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/xdebug-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/xhprof-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/redis-php.rb
brew install https://raw.github.com/josegonzalez/homebrew-php/master/Formula/phpsh.rb
curl -fsSL https://raw.github.com/phase2/laptop/master/conf_files/php.ini > /tmp/php.ini
mv /tmp/php.ini /usr/local/etc/php.ini
open /System/Library/PreferencePanes/SharingPref.prefPane
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "To prevent issues with Apache, please turn on Web Sharing now.\n\nClick \"OK\" once it has started to view the phpinfo() page." buttons {"Cancel", "OK"} default button 2'
open http://localhost/phpinfo.php
echo "Installing bash-completion and putting it into .bash_profile."
brew install bash-completion
echo '
# Find homebrew prefix if it is available.
brew_prefix=$(brew --prefix)
# Enable bash_completion from brew.
if [ -f $brew_prefix/etc/bash_completion ]; then
. $brew_prefix/etc/bash_completion
fi
# Put homebrew PHP ahead in $PATH a la http://justinhileman.info/article/reinstalling-php-53-on-mac-os-x/
export PATH=$brew_prefix/sbin:$brew_prefix/bin:$PATH' > $HOME/.bashrc
echo '
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi' > $HOME/.bash_profile
echo "Installing Drush, because we <3 Drupal and the shell."
pear channel-discover pear.drush.org
pear install drush/drush
echo "Upping max open files limit."
[[ -f /etc/launchd.conf ]] || {
need_sudo
sudo sh -c 'echo "limit maxfiles 16384" > /etc/launchd.conf'
}
echo "Installing lots of Drush coolness."
[[ -d $HOME/.drush ]] || mkdir $HOME/.drush
cd $HOME/.drush
drush dl grn
drush dl phpsh
drush dl feather
drush dl drush-vagrant
echo "Downloading VirtualBox for virtualization."
curl -fsSL http://download.virtualbox.org/virtualbox/4.1.12/VirtualBox-4.1.12-77245-OSX.dmg > $HOME/Downloads/VirtualBox-4.1.12-77245-OSX.dmg
open $HOME/Downloads/VirtualBox-4.1.12-77245-OSX.dmg
echo "Downloading Vagrant for virtualized dev environments."
curl -fsSL http://files.vagrantup.com/packages/41445466ee4d376601fd8d0c6a5e3af61d32f131/Vagrant-1.0.2.dmg > $HOME/Downloads/Vagrant-1.0.2.dmg
open $HOME/Downloads/Vagrant-1.0.2.dmg
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "Please install Vagrant, install VirtualBox and then restart.\n\nWelcome to Phase2!" buttons {"OK"}'