Last active
January 4, 2016 06:59
-
-
Save freynaud/8585626 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOST="http://freynaud-mbp.local/~freynaud/" | |
JAVA_DMG="jdk-7u45-macosx-x64.dmg" | |
XCODE_DMG="xcode_5.0.2.dmg" | |
CLI_DMG="command_line_tools_os_x_mavericks_for_xcode__late_october_2013.dmg" | |
USER="vagrant" | |
check(){ | |
if [[ $? != 0 ]] ; then | |
echo "ERROR:" | |
exit $? | |
fi | |
} | |
install_pkg(){ | |
sudo installer -pkg "$1" -target / #-verbose | |
} | |
install_app(){ | |
cp -R -f "$1" /Applications | |
} | |
# installs a dmg file containing a pkg file. | |
install_dmg_pkg(){ | |
download $1 "install.dmg" | |
hdiutil attach -mountpoint point install.dmg | |
check | |
install_pkg "point/$(ls point | grep pkg)" | |
check | |
hdiutil detach point | |
check | |
} | |
# installs a dmg file containing a app file. | |
install_dmg_app(){ | |
download $1 "install.dmg" | |
hdiutil attach -mountpoint point install.dmg | |
check | |
install_app "point/$(ls point | grep app)" | |
check | |
hdiutil detach point | |
check | |
} | |
#$1 source | |
#$2 dest | |
download(){ | |
rm -f $2 | |
curl $1 -o $2 --progress-bar | |
} | |
XCODE="" | |
rename_xcode(){ | |
NAME=$(/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version | grep code) | |
XCODE="/Applications/$NAME.app" | |
mv /Applications/Xcode.app "$XCODE" | |
} | |
1>&2 | |
rm -f point | |
mkdir point | |
# install java | |
install_dmg_pkg "$HOST$JAVA_DMG" | |
# install xcode | |
install_dmg_app "$HOST$XCODE_DMG" | |
#rename xcode | |
rename_xcode | |
# accept xcode license | |
sudo "$XCODE/Contents/Developer/usr/bin/xcodebuild" -license accept | |
# install additional packages | |
install_pkg "$XCODE/Contents/Resources/Packages/MobileDevice.pkg" | |
install_pkg "$XCODE/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" | |
install_dmg_pkg "$HOST$CLI_DMG" | |
#enable dev mode | |
sudo /usr/sbin/DevToolsSecurity -enable | |
# add vagrant user to dev group | |
sudo dscl . append /Groups/_developer GroupMembership $USER | |
# give access to instruments & co. | |
sudo security authorizationdb write system.privilege.taskport /var/tmp/system.privilege.taskport.plist | |
sudo security authorizationdb write com.apple.dt.instruments.process.analysis /var/tmp/com.apple.dt.instruments.process.analysis.plist | |
sudo security authorizationdb write com.apple.dt.instruments.process.kill /var/tmp/com.apple.dt.instruments.process.kill.plist | |
# select the latest xcode | |
sudo xcode-select -switch "$XCODE" | |
#install maven | |
#/usr/local/bin/brew install maven | |
# stop spotlight | |
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment