golang.org/x/build@v0.0.0-20240506185731-218518f32b70/env/darwin/setup-notes.md (about) 1 # For all machine types 2 3 - Turn on the computer. 4 - Click through setup, connect to wifi, etc. 5 - Full name: Gopher Gopherson 6 - Account name: gopher 7 - Password: with an exclamation mark 8 - Decline as much as possible. 9 - Set time zone to NY. 10 - Open a terminal. 11 - `sudo visudo` 12 13 Change `%admin ALL=(ALL) ALL` to `%admin ALL=(ALL) NOPASSWD: ALL`. 14 15 - `sudo nvram boot-args="-v"` 16 17 - Install Go: download the latest tarball from go.dev/dl. 18 19 `tar -xf Downloads/go*.darwin-*.tar` 20 21 `mv go $HOME/goboot` 22 23 Create `$HOME/stage0.sh`. 24 25 **For physical machines** 26 ``` 27 #!/bin/bash 28 29 set -x 30 31 mkdir -p ~/go/bin; 32 while true; do 33 rm -f ~/go/bin/buildlet 34 url="https://storage.googleapis.com/go-builder-data/buildlet.darwin-arm64" 35 while ! curl -f -o ~/go/bin/buildlet "$url"; do 36 echo 37 echo "curl failed to fetch $url" 38 echo "Sleeping before retrying..." 39 sleep 5 40 done 41 chmod +x ~/go/bin/buildlet 42 43 mkdir -p /tmp/buildlet 44 ~/go/bin/buildlet --coordinator=farmer.golang.org --reverse-type host-darwin-arm64-XX_0 --halt=false --workdir=/tmp/buildlet; 45 sleep 2; 46 done 47 ``` 48 49 **For QEMU VMs** 50 ``` 51 #!/bin/bash 52 53 set -x 54 55 export GO_BUILDER_ENV=qemu_vm 56 57 mkdir -p ~/go/bin; 58 while true; do 59 rm -f ~/go/bin/buildlet 60 url="https://storage.googleapis.com/go-builder-data/buildlet.darwin-arm64" 61 while ! curl -f -o ~/go/bin/buildlet "$url"; do 62 echo 63 echo "curl failed to fetch $url" 64 echo "Sleeping before retrying..." 65 sleep 5 66 done 67 chmod +x ~/go/bin/buildlet 68 69 mkdir -p /tmp/buildlet 70 ~/go/bin/buildlet --coordinator=farmer.golang.org --reverse-type host-darwin-arm64-XX-aws --halt=true --workdir=/tmp/buildlet; 71 sleep 2; 72 done 73 ``` 74 75 `chmod +x $HOME/stage0.sh` 76 77 - Run Automator. 78 - Create a new Application. 79 - Add a "run shell script" item with the command: 80 `open -a Terminal.app $HOME/stage0.sh` 81 - Save it to the desktop as "run-builder". 82 83 In System Preferences: 84 - Software Update > Advanced > disable checking for updates 85 - Desktop & Screensaver > uncheck show screensaver 86 - Energy Saver > never turn off display, don't automatically sleep, start up after power failure 87 - Sharing > enable ssh (leave the default administrators setting) 88 - Users & Groups > Gopher Gopherson > Login Items > add run-builder 89 - General (before 13: Users & Groups) > Login Options > auto-login Gopher Gopherson 90 - Network -> Ethernet -> Advanced -> DNS -> Add DNS server -> 8.8.8.8 91 - Only necessary on AWS guests, and until https://go.dev/issue/36718 is 92 resolved on all tested releases. 93 94 Install XCode: 95 - Download Xcode from the Apple Developer site: 96 https://stackoverflow.com/questions/10335747/how-to-download-xcode-dmg-or-xip-file. 97 https://developer.apple.com/support/xcode/ is a more authoritative list of versions. 98 (You don't want to log in to your account on the machine, so don't use the App Store.) 99 - Extract it (`xip -x file.xip`) and move the resulting Xcode folder to Applications 100 - run xcode-select: `sudo xcode-select --switch /Applications/Xcode.app` 101 - run `xcodebuild -version` and wait for Xcode to be verified, which will take a long time. 102 - accept the license: `sudo xcodebuild -license accept` 103 - install the command line tools: `sudo xcode-select --install` 104 - run xcode-select: `sudo xcode-select --switch /Library/Developer/CommandLineTools` 105 106 107 108 Install crypto/x509 test root: 109 ``` 110 curl -f -o /tmp/test_root.pem "https://storage.googleapis.com/go-builder-data/platform_root_cert.pem" 111 security add-trusted-cert -d -r trustRoot -p ssl -k /Library/Keychains/System.keychain /tmp/test_root.pem 112 ``` 113 114 Put a builder key in the usual spot.