Last active
April 17, 2020 08:55
-
-
Save phuctm97/9506335659ec4897464ec3cee9d55df4 to your computer and use it in GitHub Desktop.
π» Install macOS Catalina
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/bash | |
# Enable sudo Touch ID authentication. | |
sudo python <<HEREDOC | |
import re | |
pam_cfg = '/etc/pam.d/sudo' | |
auth_re = re.compile(r'^auth\s+sufficient\s+') | |
tid_re = re.compile(r'^auth\s+sufficient\s+pam_tid.so') | |
def main(): | |
with open(pam_cfg, 'r') as f: | |
contents = f.readlines() | |
index = -1 | |
template = 'auth sufficient ' | |
for i, line in enumerate(contents): | |
if tid_re.match(line) != None: | |
return | |
m = auth_re.match(line) | |
if m != None: | |
index = i | |
template = m.group(0) | |
contents.insert(index + 1, template + 'pam_tid.so\n') | |
with open(pam_cfg, 'w') as f: | |
f.write(''.join(contents)) | |
main() | |
HEREDOC | |
# Install XCode Command Line Tools. | |
xcode-select --install &> /dev/null | |
# Wait until XCode Command Line Tools installation finished. | |
until $(xcode-select --print-path &> /dev/null); do | |
sleep 5; | |
done | |
# Install Homebrew. | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# Fix permission issues with ZSH. | |
CWD=$(pwd) | |
cd /usr/local/share | |
sudo chmod -R 755 zsh | |
cd $CWD | |
# Install Antigen. | |
CWD=$(pwd) | |
cd /usr/local/share | |
mkdir antigen | |
sudo chmod -R 755 antigen | |
cd antigen | |
curl -L git.io/antigen > antigen.zsh | |
cd $CWD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment