99 lines · 3.4 KB · Text
RawDownload
#!/bin/sh## Run this script once to prepare your machine to develop Warp. This script is# a work in progress, and may be incomplete. set -e . "$PWD/script/warp_sudo" DEVELOPER_DIR="$(xcode-select -p 2>/dev/null || true)"if [ -z "$DEVELOPER_DIR" ] || [ ! -x "$DEVELOPER_DIR/usr/bin/xcodebuild" ] || [ "$DEVELOPER_DIR" = "/Library/Developer/CommandLineTools" ]; then    XCODE_APP=""    # Prefer the stable /Applications/Xcode.app when present so users with    # both stable and beta/versioned installs aren't switched away from it.    if [ -x "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]; then        XCODE_APP="/Applications/Xcode.app"    else        for candidate in /Applications/Xcode*.app; do            if [ -x "$candidate/Contents/Developer/usr/bin/xcodebuild" ]; then                XCODE_APP="$candidate"                break            fi        done    fi    if [ -z "$XCODE_APP" ]; then        echo "Please install Xcode before continuing."        exit 1    fi    echo "Selected Xcode at $XCODE_APP"    echo "You may be prompted for your password so bootstrap can set Xcode as the active developer directory."    warp_sudo xcode-select --switch "$XCODE_APP/Contents/Developer"fi# Mimic actually launching XCode, which performs some necessary set-up of the# development environment.xcodebuild -runFirstLaunch if ! command -v brew; then    echo "Installing brew..."    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"    echo "Please make sure brew is set correctly in your PATH"    exit 1fi if ! command -v cargo; then    echo "Installing rust..."    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh    echo "Please start a new terminal session so that cargo is in your PATH"    exit 1fi # Install various binaries through cargo."$PWD"/script/install_cargo_test_deps"$PWD"/script/install_cargo_release_deps"$PWD"/script/install_cargo_bundle # Homebrew asks for confirmation before installing by default; opt out so# bootstrap runs non-interactively.export HOMEBREW_NO_ASK=1 # Update brewbrew update brew install jqbrew install getsentry/tools/sentry-clibrew install clang-formatbrew install create-dmgbrew install multitime# Prefer the cask over the formula to avoid pulling in the dotnet formula# dependency, which fails to link when /opt/homebrew/bin/dotnet already# exists as a symlink to a non-Homebrew install (e.g. the# /usr/local/share/dotnet install from Microsoft or the Xcode toolchain).# Skip entirely when a working pwsh is already on PATH — covers an existing# cask install, a non-Homebrew /usr/local/bin/pwsh, or any other working pwsh.if ! pwsh --version >/dev/null 2>&1; then    brew install --cask powershellfibrew install pkgconfbrew install llvmbrew install protobuf # Install PSScriptAnalyzer for PowerShell lintingpwsh -Command "Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser" if ! [ "$(command -v docker)" ]; then    brew install --cask dockerfi if ! [ "$(command -v gcloud)" ]; then    brew install google-cloud-sdkfi if [[ "${WARP_SKIP_GCLOUD_AUTH:-0}" != "1" ]] && [[ -z $(gcloud auth print-identity-token) ]]; then    echo "gcloud CLI authentication missing.  Press enter to continue..."    read var    gcloud auth loginfi # Needed for building for Mac ARM machines (e.g. M1)rustup target add aarch64-apple-darwin