5

I'm looking to install the IOS Simulators via the command-line. From the plist it downloads, I can see this:

<dict>
    <key>dependencies</key>
    <array/>
    <key>fileSize</key>
    <integer>584180466</integer>
    <key>identifier</key>
    <string>Xcode.SDK.iPhoneSimulator.6.1</string>
    <key>name</key>
    <string>iOS 6.1 Simulator</string>
    <key>source</key>
    <string>http://devimages.apple.com/downloads/xcode/simulators/ios_6_1_simulator.dmg</string>
    <key>userInfo</key>
    <dict>
        <key>ActivationPredicate</key>
        <string>$XCODE_VERSION &gt;= '5.0'</string>
        <key>ApplicationsBlockingInstallation</key>
        <array>
            <string>com.apple.iphonesimulator</string>
        </array>
        <key>IconType</key>
        <string>IDEDownloadablesTypeSimulator</string>
        <key>InstallPrefix</key>
        <string>$(DEVELOPER)</string>
        <key>InstalledIfAllPathsArePresent</key>
        <array>
            <string>$(DEVELOPER)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk</string>
        </array>
        <key>RequiresADCAuthentication</key>
        <false/>
        <key>Summary</key>
        <string>This package enables testing of this previous version of iOS by installing legacy frameworks into the iOS Simulator.  If your app intends to support this version of iOS, it is highly recommended that you download this package to aid in your development and debugging.</string>
        <key>Xcode.SDKs</key>
        <array>
            <dict>
                <key>CanonicalName</key>
                <string>iphonesimulator6.1</string>
                <key>Path</key>
                <string>$(DEVELOPER)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk</string>
                <key>Platform</key>
                <string>com.apple.platform.iphonesimulator</string>
                <key>SupportedDeviceFamilies</key>
                <array>
                    <integer>1</integer>
                    <integer>2</integer>
                </array>
                <key>Version</key>
                <string>6.1</string>
            </dict>
        </array>
    </dict>
    <key>version</key>
    <string>6.1</string>
</dict> 

In here is a .dmg http://devimages.apple.com/downloads/xcode/simulators/ios_6_1_simulator.dmg and an InstallPrefix. Inside the .dmg is a .pkg file that installs to (relative) ./Platforms.

The problem is, if I just try to install that via installer:

sudo installer -pkg /Volumes/.../ios_6_1_simulator.pkg -target /

It will install to /Platforms instead of the intended /Applications/Xcode.app/Contents/Developer/Platforms.

I'm unable to set a different target that isn't a mount point. How do I get it to install to that location?

EDIT: It doesn't even work if I do set a custom mount point. Here's my attempt:

$ mkdir /tmp/SampleDir

$ hdiutil create -srcfolder "/tmp/SampleDir" -volname "Sample Install" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size 1g pack.temp.dmg
.............................................................................................................................................................................................................................................
created: /tmp/pack.temp.dmg

$ hdiutil attach -readwrite -noverify -noautoopen -mountpoint /Volumes/SampleDir "pack.temp.dmg"
/dev/disk4              GUID_partition_scheme           
/dev/disk4s1            Apple_HFS                       /Volumes/SampleDir

$ sudo installer -pkg ~/Desktop/iPhoneSimulatorSDK6_1.pkg -target /Volumes/SampleDir
Password:
installer: Package name is iPhoneSimulatorSDK6_1
installer: Installing at base path /Volumes/SampleDir
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
1

1 Answer 1

3

In a situation where you're installing a package that supports relocation, it is possible to provide an installer choices XML file to installer to modify the installation options. However, this may not be supported or available on all packages (depending on how the package was built). From the installer man page:

The customLocation attribute can be set for a choice only if that choice
explicitly allows a user-defined path. That is, if the choice would have a
Location popup when viewed in the Customize pane of the Installer application, it 
can be set via customLocation.  (Otherwise, installation paths cannot be 
arbitrarily modified, since the package author must account for custom install 
locations for the installation to work properly.)

From what I can see, the iPhoneSimulatorSDK6_1.pkg that you're referencing does not support this option. However, it is still possible to perform the relocation of the installer package payload after installation:

sudo installer -pkg /Volumes/Bittersweet6M149.iPhoneSimulatorSDK6_1/iPhoneSimulatorSDK6_1.pkg -tgt /
sudo mv /Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator/Developer/SDKs

Alternately, you can use pkgutil to expand the package, cpio to extract the payload, and mvto put the SDK into place:

pkgutil --expand /Volumes/Bittersweet6M149.iPhoneSimulatorSDK6_1/iPhoneSimulatorSDK6_1.pkg ~/iPhoneSimulator6_1
cd ~/iPhoneSimulator6_1
cpio -i -I ~/iPhoneSimulator6_1/Payload
sudo mv Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator/Developer/SDKs

I'm not sure exactly how Xcode places the simulators/SDKs into the correct location. However, both of the methods mentioned above allow the iOS 6.1 simulator to be used within Xcode 5.0.2 on Mavericks (10.9).

1
  • fix: pkutil -> pkgutil
    – DanSkeel
    Mar 30, 2016 at 11:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .