forked from phase2/laptop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmac
130 lines (105 loc) · 5.4 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.)" 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 "$(curl -fsSL https://raw.github.com/gist/323731)"
brew update
echo "Installing GNU userland tools."
brew install coreutils gnu-sed findutils
echo "Install git and gist tools."
brew install git gist
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://gist.github.com/raw/ee51e16448d49fcc123e/f6520b9489b3c17da742467b2b082189796223c2/gistfile1.txt > /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
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
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, MySQL and internationalization support."
brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/php.rb --with-mysql --with-intl
curl -fsSL https://gist.github.com/raw/9f0504965c5a3ac6e641/21853d00b80cc0610968c86993b5ffcf6e6221a9/gistfile1.txt | sed -e "s/@@USER@@/$USER/" > /tmp/httpd.conf
curl -fsSL https://gist.github.com/raw/d5c3b90c11081ccaac6e/3e34c0d85c299beb23290b5bd321a0d534e07340/gistfile1.txt > /tmp/httpd-extra-config.conf
curl -fsSL https://gist.github.com/raw/ce375c5af73ec5ae9f27/5ac7aa5df31ec3df8b91cfa7e1fb79af9a978d43/gistfile1.txt | 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.8/lib/php
pear config-set 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 RVM (Ruby Version Manager) ..."
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer --version latest
echo "
# RVM
[[ -s '/Users/`whoami`/.rvm/scripts/rvm' ]] && source '/Users/`whoami`/.rvm/scripts/rvm'" >> $HOME/.bashrc
source $HOME/.bashrc
echo "Installing Drush, because we <3 Drupal."
brew install 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 phpsh for PHP development awesomeness."
mkdir $HOME/Documents/Development
cd $HOME/Documents/Development
git clone https://github.com/facebook/phpsh.git
cd phpsh
python setup.py build
need_sudo
sudo python setup.py install
echo "Installing drush-toolbox for even more awesomeness."
[[ -d $HOME/.drush ]] || mkdir $HOME/.drush
cd $HOME/.drush
git clone https://github.com/zroger/drush-toolbox.git
bash < <(curl -s https://raw.github.com/treehouseagency/laptop/master/ruby)
echo "Installing VirtualBox for virtualization."
curl -fsSL http://download.virtualbox.org/virtualbox/4.1.2/VirtualBox-4.1.2-73507-OSX.dmg > $HOME/Downloads/VirtualBox-4.1.2-73507-OSX.dmg
open $HOME/Downloads/VirtualBox-4.1.2-73507-OSX.dmg
osascript -e 'tell app "System Events" to activate'
osascript -e 'tell app "System Events" to display dialog "Please install VirtualBox and then restart.\n\nWelcome to the Treehouse!" buttons {"OK"}'