Skip to content

Commit b705c20

Browse files
authored
Merge pull request #48 from nbeadman/master
Xcode 10 support for OS X 10.13 SDK
2 parents 7605efe + 2b615b8 commit b705c20

File tree

3 files changed

+89
-17
lines changed

3 files changed

+89
-17
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
*.dmg
22
*.dmg.part
33
*.pkg
4+
*.xip
5+
*.app
46
*.tar.gz
57
*.tar.xz
68

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
XcodeLegacy
22
===========
33

4-
Legacy components for Xcode 4-8 (deprecated compilers and Mac OS X SDKs).
4+
Legacy components for Xcode 4-10 (deprecated compilers and Mac OS X SDKs).
55

66
Home page: https://github.com/devernay/xcodelegacy
77

@@ -10,12 +10,12 @@ Description
1010

1111
Many components were removed in recent versions of Xcode, the most notable being the Mac OS X 10.6 SDK, which is required to build software using the Carbon API (such as wxWidgets 2.8).
1212

13-
I made the script XcodeLegacy.sh to extract these components (the links work if you [sign in to Apple Developer](https://developer.apple.com/downloads/) first) from [Xcode 3.2.6](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg) (10.4, 10.5 and 10.6 SDKs, PPC assembler, GCC 4.0 and 4.2, LLVM-GCC 4.2), [Xcode 4.6.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) (10.7 SDK), [Xcode 5.1.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) (10.8 SDK), [Xcode 6.4](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg) (10.9 and 10.10 SDKs), [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) (10.11 SDK) and install them in Xcode 4-8:
13+
I made the script XcodeLegacy.sh to extract these components (the links work if you [sign in to Apple Developer](https://developer.apple.com/downloads/) first) from [Xcode 3.2.6](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg) (10.4, 10.5 and 10.6 SDKs, PPC assembler, GCC 4.0 and 4.2, LLVM-GCC 4.2), [Xcode 4.6.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) (10.7 SDK), [Xcode 5.1.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) (10.8 SDK), [Xcode 6.4](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg) (10.9 and 10.10 SDKs), [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) (10.11 SDK), [Xcode 8.3.3](https://download.developer.apple.com/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip) (10.12 SDK), [Xcode 9.4.1](https://download.developer.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip) (10.13 SDK) and install them in Xcode 4-10:
1414

1515
- GCC 4.0, GCC 4.2 and LLVM GCC 4.2 compilers
1616
- GCC 4.0, GCC 4.2 and LLVM GCC 4.2 Xcode plugins
1717
- PPC assembler
18-
- Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
18+
- Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13
1919

2020
The script also fixes a few known bugs in the 10.4, 10.5 and 10.6 SDK.
2121

@@ -35,7 +35,7 @@ Open a Terminal application, change to the directory where `XcodeLegacy.sh`, and
3535
cd path/to/xcodelegacy
3636
chmod +x XcodeLegacy.sh
3737
```
38-
Execute the script by typing `./XcodeLegacy.sh <arg>`. The script takes one argument, which can be "buildpackages" (to extract components from the legacy Xcode downloads to the current directory), "install" (to install the components in Xcode 4-8), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4-8).
38+
Execute the script by typing `./XcodeLegacy.sh <arg>`. The script takes one argument, which can be "buildpackages" (to extract components from the legacy Xcode downloads to the current directory), "install" (to install the components in Xcode 4-10), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4-10).
3939

4040
With the "install" or "uninstall" arguments, the script uses sudo to become root, and will thus ask for your password. Please check the script contents before executing it.
4141

@@ -51,6 +51,7 @@ Optionally, one of the following options can be passed as the *first* argument t
5151
* `-osx1010` : only install OSX 10.10 SDK
5252
* `-osx1011` : only install OSX 10.11 SDK
5353
* `-osx1012` : only install OSX 10.12 SDK
54+
* `-osx1013` : only install OSX 10.13 SDK
5455

5556

5657
Using the older SDKs
@@ -111,6 +112,7 @@ Here are the latest versions of Xcode that are known to /run/ on each OS X versi
111112
- [Xcode 7.2.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.2.1/Xcode_7.2.1.dmg) on OS X 10.10 (Yosemite)
112113
- [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) on OS X 10.11 (El Capitan), please see note on linking below. [Xcode 8.2.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_8.2.1/Xcode_8.2.1.xip) also runs on OS X 10.11, but can only compile for macOS 10.12.
113114
- [Xcode 8.3.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip) on macOS 10.12 (Sierra), please see note on linking below.
115+
- [Xcode 9.4.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip) on macOS 10.13 (High Sierra), please see note on linking below.
114116

115117
(*) These Xcode versions were released before 26.03.2012 and may cause an "An unknown installation error" during installation, which is due to an expired certificate. Installing these may require disabling network time sync and setting the date to 01.01.2012 before installing. Network time sync may be re-enabled after install. See [this stackexchange question](https://apple.stackexchange.com/questions/45841/xcode-4-2-snow-leopard-doesnt-install) for more details.
116118

@@ -207,4 +209,5 @@ History
207209
- 1.7 (05/04/2016): Xcode 7.3 disables support for older SDKs, fix that
208210
- 1.9 (16/09/2016): Xcode 8 dropped 10.11 SDK, get it from Xcode 7.3.1
209211
- 2.0 (02/05/2017): Xcode 8 cannot always link i386 for OS X 10.5, use the Xcode 3 linker for this arch too. Force use of legacy assembler with GCC 4.x.
210-
- 2.1 (17/01/2017): Xcode 9 dropped 10.12 SDK, get it from https://github.com/phracker/MacOSX-SDKs; fix compiling with GNU Ada, and many other fixes
212+
- 2.1 (17/01/2017): Xcode 9 dropped 10.12 SDK, get it from Xcode 8.3.3; fix compiling with GNU Ada, and many other fixes
213+
- 2.2 (10/01/2019): Xcode 10 dropped 10.13 SDK, get it from Xcode 9.4.1

XcodeLegacy.sh

100644100755
Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# - Jae Liu <ling32945@github>
88
# - Eric Knibbe <EricFromCanada@github>
99
# - Chris Roueche <croueche@github>
10+
# - Kris Coppieters <zwettemaan@github>
11+
# - Nick Beadman <[email protected]> / <nbeadman@github>
1012
#
1113
# License: Creative Commons BY-NC-SA 3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/
1214
#
@@ -23,6 +25,7 @@
2325
# 1.9 (16/09/2016): Xcode 8 dropped 10.11 SDK, get it from Xcode 7.3.1
2426
# 2.0 (02/05/2017): Xcode 8 cannot always link i386 for OS X 10.5, use the Xcode 3 linker for this arch too. Force use of legacy assembler with GCC 4.x.
2527
# 2.1 (17/01/2017): Xcode 9 dropped 10.12 SDK, get it from https://github.com/phracker/MacOSX-SDKs; fix compiling with GNU Ada, and many other fixes
28+
# 2.2 (12/02/2019): Added support for using macOS High Sierra 10.13 SDK from Xcode 9.4.1 for use on Xcode 10/macOS 10.14 Mojave, also changed source of OS X 10.12 SDK to Xcode 8.3.3
2629

2730
#set -e # Exit immediately if a command exits with a non-zero status
2831
#set -u # Treat unset variables as an error when substituting.
@@ -38,6 +41,7 @@ osx109=0
3841
osx1010=0
3942
osx1011=0
4043
osx1012=0
44+
osx1013=0
4145
gotoption=0
4246
error=0
4347

@@ -94,6 +98,11 @@ while [[ $error = 0 ]] && [[ $# -gt 1 ]]; do
9498
gotoption=1
9599
shift
96100
;;
101+
-osx1013)
102+
osx1013=1
103+
gotoption=1
104+
shift
105+
;;
97106
*)
98107
# unknown option or spurious arg
99108
error=1
@@ -113,19 +122,20 @@ if [ $gotoption = 0 ]; then
113122
osx1010=1
114123
osx1011=1
115124
osx1012=1
125+
osx1013=1
116126
fi
117127

118128
if [ $# != 1 ]; then
119129
# ################################################################################ 80 cols
120-
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta"
130+
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012|-osx1013] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta"
121131
echo ""
122132
echo "Description: Extracts / installs / cleans / uninstalls the following components"
123-
echo "from Xcode 3.2.6, Xcode 4.6.3, Xcode 5.1.1, Xcode 6.4 and Xcode 7.3.1, which"
133+
echo "from Xcode 3.2.6, Xcode 4.6.3, Xcode 5.1.1, Xcode 6.4, Xcode 7.3.1, Xcode 8.3.3 and Xcode 9.4.1 which"
124134
echo "are not available in Xcode >= 4.2:"
125135
echo " - PPC assembler and linker"
126136
echo " - GCC 4.0 and 4.2 compilers and Xcode plugins"
127137
echo " - LLVM-GCC 4.2 compiler and Xcode plugin (Xcode >= 5)"
128-
echo " - Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11"
138+
echo " - Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13"
129139
echo ""
130140
echo "An optional first argument may be provided to limit the operation (by default"
131141
echo "everything is done):"
@@ -140,6 +150,7 @@ if [ $# != 1 ]; then
140150
echo " -osx1010 : only install OSX 10.10 SDK"
141151
echo " -osx1011 : only install OSX 10.11 SDK"
142152
echo " -osx1012 : only install OSX 10.12 SDK"
153+
echo " -osx1013 : only install OSX 10.13 SDK"
143154
echo "Note that these can be combined. For example, to build and install the 10.9"
144155
echo "and 10.10 SDKs, one could execute:"
145156
echo " $ $0 -osx109 -osx1010 buildpackages"
@@ -199,6 +210,8 @@ xc4="$(( compilers + osx107 != 0 ))"
199210
xc5="$(( osx108 != 0 ))"
200211
xc6="$(( osx109 + osx1010 != 0 ))"
201212
xc7="$(( osx1011 != 0 ))"
213+
xc8="$(( osx1012 != 0 ))"
214+
xc9="$(( osx1013 != 0 ))"
202215

203216
# The sole argument is the macOS version (e.g. 10.12)
204217
installSDK() {
@@ -213,9 +226,8 @@ installSDK() {
213226
(gzip -dc MacOSX${macos}.sdk.tar.xz | (cd "$SDKDIR/SDKs" || exit; tar xf -)) && echo "*** installed MacOSX${macos}.sdk.tar.xz"
214227
else
215228
echo "*** Could not install MacOSX${macos}.sdk"
216-
echo "*** Before installing, either:"
229+
echo "*** Before installing:"
217230
echo "- execute \"$0 buildpackages\""
218-
echo "- download MacOSX${macos}.sdk.tar.xz from https://github.com/phracker/MacOSX-SDKs/releases and relaunch \"$0 install\""
219231
exit 1
220232
fi
221233
touch "$SDKDIR/SDKs/MacOSX${macos}.sdk/legacy"
@@ -230,7 +242,7 @@ case $1 in
230242
missingdmg=0
231243
# note: Xcode links from http://stackoverflow.com/questions/10335747/how-to-download-xcode-4-5-6-7-and-get-the-dmg-file/10335943#10335943
232244
if [ "$xc3" = 1 ] && [ ! -f xcode_3.2.6_and_ios_sdk_4.3.dmg ]; then
233-
echo "*** you should download Xcode 3.2.6. Login to:"
245+
echo "*** You should download Xcode 3.2.6. Login to:"
234246
echo " https://developer.apple.com/downloads/"
235247
echo "then download from:"
236248
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg"
@@ -240,7 +252,7 @@ case $1 in
240252
missingdmg=1
241253
fi
242254
if [ "$xc4" = 1 ] && [ ! -f xcode4630916281a.dmg ]; then
243-
echo "*** you should download Xcode 4.6.3. Login to:"
255+
echo "*** You should download Xcode 4.6.3. Login to:"
244256
echo " https://developer.apple.com/downloads/"
245257
echo "then download from:"
246258
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg"
@@ -250,7 +262,7 @@ case $1 in
250262
missingdmg=1
251263
fi
252264
if [ "$xc5" = 1 ] && [ ! -f xcode_5.1.1.dmg ]; then
253-
echo "*** you should download Xcode 5.1.1. Login to:"
265+
echo "*** You should download Xcode 5.1.1. Login to:"
254266
echo " https://developer.apple.com/downloads/"
255267
echo "then download from:"
256268
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg"
@@ -260,7 +272,7 @@ case $1 in
260272
missingdmg=1
261273
fi
262274
if [ "$xc6" = 1 ] && [ ! -f Xcode_6.4.dmg ]; then
263-
echo "*** you should download Xcode 6.4. Login to:"
275+
echo "*** You should download Xcode 6.4. Login to:"
264276
echo " https://developer.apple.com/downloads/"
265277
echo "then download from:"
266278
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg"
@@ -270,7 +282,7 @@ case $1 in
270282
missingdmg=1
271283
fi
272284
if [ "$xc7" = 1 ] && [ ! -f Xcode_7.3.1.dmg ]; then
273-
echo "*** you should download Xcode 7.3.1. Login to:"
285+
echo "*** You should download Xcode 7.3.1. Login to:"
274286
echo " https://developer.apple.com/downloads/"
275287
echo "then download from:"
276288
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg"
@@ -279,10 +291,33 @@ case $1 in
279291
echo "and then run this script from within the same directory as the downloaded file"
280292
missingdmg=1
281293
fi
294+
if [ "$xc8" = 1 ] && [ ! -f Xcode8.3.3.xip ]; then
295+
echo "*** You should download Xcode 8.3.3. Login to:"
296+
echo " https://developer.apple.com/downloads/"
297+
echo "then download from:"
298+
echo " https://download.developer.apple.com/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip"
299+
echo "and then run this script from within the same directory as the downloaded file"
300+
missingdmg=1
301+
fi
302+
if [ "$xc9" = 1 ] && [ ! -f Xcode_9.4.1.xip ]; then
303+
echo "*** You should download Xcode 9.4.1. Login to:"
304+
echo " https://developer.apple.com/downloads/"
305+
echo "then download from:"
306+
echo " https://download.developer.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip"
307+
echo "and then run this script from within the same directory as the downloaded file"
308+
missingdmg=1
309+
fi
282310
if [ "$missingdmg" = 1 ]; then
283311
echo "*** at least one Xcode distribution is missing, cannot build packages - exiting now"
284312
exit
285313
fi
314+
if [ "$xc8" = 1 ]; then
315+
if [ -e Xcode.app ]; then
316+
echo "*** A stray Xcode.app exists in the XcodeLegacy.sh folder. Remove it then try again."
317+
exit
318+
fi
319+
fi
320+
286321
MNTDIR="$(mktemp -d mount.XXX)"
287322
ATTACH_OPTS=(-nobrowse -mountroot "$MNTDIR")
288323
if [ "$xc3" = 1 ]; then
@@ -548,8 +583,29 @@ EOF
548583
fi
549584
hdiutil detach "$MNTDIR/Xcode" -force
550585
fi
551-
if [ "$osx1012" = 1 ]; then
552-
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.12.sdk.tar.xz
586+
if [ "$xc8" = 1 ]; then
587+
if [ "$osx1012" = 1 ]; then
588+
echo "Extracting Mac OS X 10.12 SDK from Xcode 8.3.3. Be patient - this will take some time"
589+
open Xcode8.3.3.xip
590+
while [ ! -d Xcode.app ]; do
591+
sleep 5
592+
done
593+
sleep 5
594+
( (cd "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" || exit; rm SDKs/MacOSX10.12.sdk; mv SDKs/MacOSX.sdk SDKs/MacOSX10.12.sdk; tar cf - SDKs/MacOSX10.12.sdk) | gzip -c > Xcode1012SDK.tar.gz) && echo "*** Created Xcode1012SDK.tar.gz in directory $(pwd)"
595+
rm -rf Xcode.app
596+
fi
597+
fi
598+
if [ "$xc9" = 1 ]; then
599+
if [ "$osx1013" = 1 ]; then
600+
echo "Extracting Mac OS X 10.13 SDK from Xcode 9.4.1. Be patient - this will take some time"
601+
open Xcode_9.4.1.xip
602+
while [ ! -d Xcode.app ]; do
603+
sleep 5
604+
done
605+
sleep 5
606+
( (cd "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" || exit; rm SDKs/MacOSX10.13.sdk; mv SDKs/MacOSX.sdk SDKs/MacOSX10.13.sdk; tar cf - SDKs/MacOSX10.13.sdk) | gzip -c > Xcode1013SDK.tar.gz) && echo "*** Created Xcode1013SDK.tar.gz in directory $(pwd)"
607+
rm -rf Xcode.app
608+
fi
553609
fi
554610
rmdir "$MNTDIR"
555611
;;
@@ -957,6 +1013,10 @@ SPEC_EOF
9571013
installSDK 10.12
9581014
fi
9591015

1016+
if [ "$osx1013" = 1 ]; then
1017+
installSDK 10.13
1018+
fi
1019+
9601020
if [ "$compilers" = 1 ]; then
9611021
if [ -f /usr/bin/gcc-4.0 ]; then
9621022
#echo "*** Not installing xcode_3.2.6_gcc4.0.pkg (found installed in /usr/bin/gcc-4.0, uninstall first to force install)"
@@ -1085,6 +1145,9 @@ SPEC_EOF
10851145
if [ "$osx1012" = 1 ]; then
10861146
rm Xcode1012SDK.tar.gz 2>/dev/null
10871147
fi
1148+
if [ "$osx1012" = 1 ]; then
1149+
rm Xcode1013SDK.tar.gz 2>/dev/null
1150+
fi
10881151

10891152
;;
10901153

@@ -1193,6 +1256,10 @@ SPEC_EOF
11931256
i=10.12
11941257
[ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk"
11951258
fi
1259+
if [ "$osx1013" = 1 ]; then
1260+
i=10.13
1261+
[ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk"
1262+
fi
11961263

11971264
if [ "$compilers" = 1 ]; then
11981265
if [ "$GCCINSTALLDIR/usr/bin/gcc" -ef "$GCCINSTALLDIR/usr/bin/clang" ]; then

0 commit comments

Comments
 (0)