├── README.md └── install.sh /README.md: -------------------------------------------------------------------------------- 1 | Install Standalone Developer Tools from Xcode 3.2.6 2 | =================================================== 3 | 4 | Starting with Xcode 4, Apple started distributing developer tools like FileMerge 5 | inside the Xcode app; you must download Xcode from the Mac App Store to install 6 | these tools. This is inconvenient for developers who do not need Xcode: 7 | 8 | - Xcode takes a long time to download. 9 | - Xcode takes up a lot of space, since it includes a few iOS boot images. 10 | - Merely installing Xcode will cause the default "Open With:" file associations 11 | for many scripts to be changed to Xcode, and the associate for each type of 12 | script must be changed back manually. 13 | 14 | Furthermore, Property List Editor is now part of Xcode and is no longer its own 15 | app. Xcode's integrated property list editor has more features, but Xcode takes 16 | a long time to start up and uses a lot of memory. Standalone Property List 17 | Editor takes less than a second to start up. 18 | 19 | Fortunately, the standalone developer tools included with Xcode 3.2.6 still work 20 | up to Mac OS 10.11, and some of them (unfortunately, not Property List Editor) 21 | still work in 10.12. This repo provides an easy way to install these tools 22 | without installing the rest of the Xcode package. 23 | 24 | To install the developer tools, first go to 25 | [https://developer.apple.com/download/more/](https://developer.apple.com/download/more/). 26 | Log in with your Apple ID and download "Xcode 3.2.6 and iOS SDK 4.3 for Snow 27 | Leopard". 28 | 29 | 30 | Then, to install for the current user, to `~/Developer`: 31 | 32 | ```sh 33 | curl -fsSL https://goo.gl/RBK09o | /bin/bash 34 | ``` 35 | 36 | Or, to install for all users, to `/Developer`, run with `sudo`: 37 | 38 | ```sh 39 | curl -fsSL https://goo.gl/RBK09o | /usr/bin/sudo /bin/bash 40 | ``` 41 | 42 | To uninstall, just move `/Developer` or `~/Developer` to the trash. The 43 | installer does not install files anywhere else. 44 | 45 | That's all. Enjoy! -[@szhu](https://github.com/szhu) 46 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is the installer for szhu/install-standalone-xcode-tools. For more info: 3 | # https://github.com/szhu/install-standalone-xcode-tools 4 | set -e 5 | 6 | # Echo only if $VERBOSE 7 | log() { 8 | [[ -z "$VERBOSE" ]] || echo "$@" 9 | } 10 | 11 | # Echo the command only if $VERBOSE, then run it 12 | log-do() { 13 | log "$@" 14 | "$@" 15 | } 16 | 17 | # Formatted unconditional echo 18 | info() { 19 | if [[ -z "$1" ]]; then 20 | echo 21 | return 22 | fi 23 | echo "$1" 24 | shift 25 | for line in "$@"; do echo " $line"; done 26 | } 27 | 28 | 29 | dmg="$1" 30 | 31 | if [[ -z "$dmg" ]]; then 32 | info "First, go to:" \ 33 | "https://developer.apple.com/download/more/" 34 | info "Log in with your Apple ID and download:" \ 35 | "Xcode 3.2.6 and iOS SDK 4.3 for Snow Leopard" 36 | info 37 | info "After it is downloaded, press Enter to select the file." 38 | info "(Or you can re-run the tool with the file as the first argument.)" 39 | read 40 | 41 | # Show the file chooser dialog as the current user, even when run with sudo, 42 | # to prevent the dialog from showing root's default location and sidebar. 43 | if [[ "$UID" -eq 0 ]]; then 44 | as_current_user=(sudo -u "$SUDO_USER") 45 | else 46 | as_current_user= 47 | fi 48 | [[ -n "$dmg" ]] || 49 | dmg_raw="$( 50 | ${as_current_user[*]} osascript -l JavaScript -e " 51 | app = Application.currentApplication(); 52 | app.includeStandardAdditions = true; 53 | console.log(app.chooseFile({ 54 | withPrompt: 'Where is xcode_3.2.6_and_ios_sdk_4.3.dmg?', 55 | ofType: ['dmg', 'com.apple.disk-image-udif'], 56 | })); 57 | " 2>&1 58 | )" 59 | dmg=$(echo "$dmg_raw" | tail -1) 60 | fi 61 | info "Selected disk image:" "$dmg" 62 | 63 | # http://osxdaily.com/2011/12/17/mount-a-dmg-from-the-command-line-in-mac-os-x/ 64 | log hdiutil attach "$dmg" 65 | volume="$( 66 | hdiutil attach "$dmg" | 67 | python -c 'from sys import stdin; print stdin.read().splitlines()[-1].split("\t", 3)[-1]' 68 | )" 69 | info "Mounted volume:" "$volume" 70 | 71 | [[ -n "$TMPDIR" ]] || TMPDIR="/tmp" 72 | tmp="${TMPDIR%/}/xcodedevtools.$$" 73 | log-do mkdir "$tmp" 74 | info "Using tmpdir:" "$tmp" 75 | 76 | info "Extracting (Stage 1/2)..." 77 | if [[ ! -e "$volume/Packages/DeveloperTools.pkg" ]]; then 78 | info "Can't find the install package at:" "$volume/Packages/DeveloperTools.pkg" 79 | info "Perhaps you downloaded the wrong disk image." 80 | exit 1 81 | fi 82 | log-do xar -xf "$volume/Packages/DeveloperTools.pkg" -C "$tmp" 83 | 84 | if [[ "$UID" -eq 0 ]]; then 85 | info "Extracting (Stage 2/2)..." 86 | log-do ditto -x "$tmp/Payload" /Developer 87 | info "Succcessfully installed to:" "/Developer" 88 | else 89 | info "Installing (Stage 2/2)..." 90 | log-do ditto -x "$tmp/Payload" ~/Developer 91 | info "Succcessfully installed to:" "$HOME/Developer" 92 | fi 93 | info "To uninstall, just move this folder to the trash." 94 | 95 | info 96 | info "Cleaning up..." 97 | log-do rm -rf "$tmp" 98 | info "Deleted tmpdir." 99 | log-do umount -f "$volume" 100 | info "Unmounted volume." 101 | --------------------------------------------------------------------------------