Xcode -- Running as a non-admin

Byte
New Contributor

Hey Guys,

We removed our admin rights from our developers :(
Because of this xcode seems to have some issues that im dealing with at this point
We are running a script (found on jamfnation) which basically alleviates most issues as it puts the user in the developer group and gets rid of all initial prompts

One of the problems we are faced with is When clicking xcode --> Preferences --> Components --> and we attempt to download any of the ios simulators we are faced with a username/password admin prompt :(
Im sure there are many people here whom overcame this issue as we are not the only company to remove a developers admin rights, without impeding their ability to work

1 ACCEPTED SOLUTION

Stevie
Contributor

Hello,

You need to download the simulators within Xcode then repackage them for deployment. Here is the basic process which I use to deploy them :

  • Install Xcode from the Apple or the Developer website.​
  • Open Xcode and got to Preferences and select downloads. In the below example only iOS 9.0 Simulator is installed. a6ab4fee7bb74a288796e0bfc3bf0fc0
  • Click on the required simunlator and enter the local administrator details and open the folder ~/Library/Caches/com.apple.dt.Xcode/Downloads​. This is the location which the disk image is downloaded too and will be required for re-packaging.​ In the below example tvOS 9.1 Simulator has downloaded and is now waiting to be installed. cb78b01b4b7941b6aee3b41a382b4412
  • Before entering the password copy the .dmg file into a new location for example ~/Desktop/Simulators/Disk Images​ as it will be requried later. Enter the password and wait for the instllation to finish.
  • Open the following folder after the installation /Library/Developer/CoreSimulator/Profiles/Runtimes and make a note of the name of the simulator in this example tvOS 9.1.simruntime is the information which we are looking for. 3982b9d591564265b340bd8c52c8c988
  • Open ~/Desktop/Simulators/Disk Images​ and mount the disk image and copy the .pkg into ~/Desktop/Simulators/Original PKG.
  • The original PKG needs to be expanded so that the PackageInfo​ file can be edited the command which will be used is pkgutil --expand <Source PKG> <Destination Folder>
pkgutil --expand ~/Desktop/Simulators/Original PKG/AppleTVSimulatorSDK9_1.pkg ~/Desktop/Simulators/AppleTVSimulatorSDK9_1
  • Edit the PackageInfo and look for the text <pkg-info auth="root"​ and insert the text install-location="/Library/Developer/CoreSimulator/Profiles/Runtimes/<simulator name>" and save the file​. The simulator name can be found in step 5. In our example for the TV simulator the new text would read.
<pkg-info install-location="/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 9.1.simruntime" auth="root"​
  • The new package need to be flattened back into a .PKG file using the command pkgutil --flatten <Destination Folder> <Source PKG>. In the current example the command will be
pkgutil --flatten ~/Simulators/AppleTVSimulatorSDK9_1 ~/Desktop/Simulators/tvOS 9.1 Simulator.pkg
  • The new package will need to be uploaded to the Casper server and tested on a clean built to confirm that the package changes are working. If the package has been editied correctly the simulator will be installed into /Library/Developer/CoreSimulator/Profiles/Runtimes folder.

Now to track who has which simulator installed I created an extension attribute with the name of the simulator i.e "tvOS 0.1 Simulator".

#!/bin/sh

Path="/Library/Developer/CoreSimulator/Profiles/Runtimes"
cd $Path
CoreSimulator="tvOS 9.1.simruntime"

if [ -d "$CoreSimulator" ]; then
echo "<result>Installed</result>"
else
echo "<result>Missing</result>"

fi

I also change the group ownership of Xcode to _developer and make sure that the users are in this local group.

regards

Steve

View solution in original post

5 REPLIES 5

Stevie
Contributor

Hello,

You need to download the simulators within Xcode then repackage them for deployment. Here is the basic process which I use to deploy them :

  • Install Xcode from the Apple or the Developer website.​
  • Open Xcode and got to Preferences and select downloads. In the below example only iOS 9.0 Simulator is installed. a6ab4fee7bb74a288796e0bfc3bf0fc0
  • Click on the required simunlator and enter the local administrator details and open the folder ~/Library/Caches/com.apple.dt.Xcode/Downloads​. This is the location which the disk image is downloaded too and will be required for re-packaging.​ In the below example tvOS 9.1 Simulator has downloaded and is now waiting to be installed. cb78b01b4b7941b6aee3b41a382b4412
  • Before entering the password copy the .dmg file into a new location for example ~/Desktop/Simulators/Disk Images​ as it will be requried later. Enter the password and wait for the instllation to finish.
  • Open the following folder after the installation /Library/Developer/CoreSimulator/Profiles/Runtimes and make a note of the name of the simulator in this example tvOS 9.1.simruntime is the information which we are looking for. 3982b9d591564265b340bd8c52c8c988
  • Open ~/Desktop/Simulators/Disk Images​ and mount the disk image and copy the .pkg into ~/Desktop/Simulators/Original PKG.
  • The original PKG needs to be expanded so that the PackageInfo​ file can be edited the command which will be used is pkgutil --expand <Source PKG> <Destination Folder>
pkgutil --expand ~/Desktop/Simulators/Original PKG/AppleTVSimulatorSDK9_1.pkg ~/Desktop/Simulators/AppleTVSimulatorSDK9_1
  • Edit the PackageInfo and look for the text <pkg-info auth="root"​ and insert the text install-location="/Library/Developer/CoreSimulator/Profiles/Runtimes/<simulator name>" and save the file​. The simulator name can be found in step 5. In our example for the TV simulator the new text would read.
<pkg-info install-location="/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 9.1.simruntime" auth="root"​
  • The new package need to be flattened back into a .PKG file using the command pkgutil --flatten <Destination Folder> <Source PKG>. In the current example the command will be
pkgutil --flatten ~/Simulators/AppleTVSimulatorSDK9_1 ~/Desktop/Simulators/tvOS 9.1 Simulator.pkg
  • The new package will need to be uploaded to the Casper server and tested on a clean built to confirm that the package changes are working. If the package has been editied correctly the simulator will be installed into /Library/Developer/CoreSimulator/Profiles/Runtimes folder.

Now to track who has which simulator installed I created an extension attribute with the name of the simulator i.e "tvOS 0.1 Simulator".

#!/bin/sh

Path="/Library/Developer/CoreSimulator/Profiles/Runtimes"
cd $Path
CoreSimulator="tvOS 9.1.simruntime"

if [ -d "$CoreSimulator" ]; then
echo "<result>Installed</result>"
else
echo "<result>Missing</result>"

fi

I also change the group ownership of Xcode to _developer and make sure that the users are in this local group.

regards

Steve

Byte
New Contributor

@Stevie

Thanks so much for this info

Byte
New Contributor

.

Byte
New Contributor

.

jimmy-swings
Contributor II

Anyone had success installing & supporting Xcode 9.0?