forked from geerlingguy/mac-dev-playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
49 lines (37 loc) · 1.51 KB
/
start.sh
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
#!/bin/sh
# Installs Xcode Developer Tools, Rosetta 2, and Ansible on a new macOS machine.
# This script is only intended to be run on a brand-new machine running macOS.
# Once Homebrew's been installed and the Ansible playbook has been run at least
# once, it is recommended to install your tools manually.
set -e
YELLOW="\033[33m"
BOLDCYAN="\033[1;36m"
ENDCOLOR="\033[0m"
echo "Checking if Xcode Developer Tools is installed"
if xcode-select -p 1>/dev/null; [ "$?" -ne 0 ]; then
echo "${YELLOW}Not yet installed, installing now (a EULA will pop up)${ENDCOLOR}"
xcode-select --install
else
echo "It is already installed."
fi
echo "Ensuring ~/.ssh/ exists (will create if not)"
mkdir -p ~/.ssh
echo "Installing Rosetta 2"
softwareupdate --install-rosetta --agree-to-license
# Only temp-setting it to the Xcode Developer Tool version of Python for the
# current shell session because Homebrew will install a proper Python version
# later on.
export PATH="$HOME/Library/Python/3.8/bin:$PATH"
echo "Upgrading pip (requires sudo password)"
sudo pip3 install --upgrade pip
echo "Installing Ansible"
pip3 install ansible
echo "Installing Playbook requirements"
ansible-galaxy install -r requirements.yml
echo ""
echo "${YELLOW}Done. Copy & paste the following commands to continue setup:${ENDCOLOR}"
echo ""
echo "${BOLDCYAN}export PATH=\"\$HOME/Library/Python/3.8/bin:\$PATH\"${ENDCOLOR}"
echo "${BOLDCYAN}ansible-playbook main.yml --ask-become-pass${ENDCOLOR}"
echo ""
echo "${YELLOW}It will ask for your sudo password.${ENDCOLOR}"