DetailsXcode documentAutomatic InstallationScriptIs the content to be introduced in this article, each upgradeXcodeOr the iPhone SDK, which was previously downloadedDocumentWill be deleted and re-initiated. This may not be a big problem for Apple developers who are quickly connected to the Internet, but for many domestic users, download n GiBDocumentIt is a heavy burden. Forced to do so, this time I wroteScriptTo solve the problem.
The method is simple. Place the iPhone document and Mac document in the two sub-directories of iOS and Mac respectively, and then create the following script:
- #!/bin/bash
- macdocs='/Developer/Documentation/DocSets/'
- iosdocs='/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/'
- # Function: Extract Docs From Xar Archivesdo_extract() {
- echo In directory: $1
- echo Extract xars... for file in `ls -1`
- do
- xar -xf $file
- done
-
- echo Delete xars...
- rm -f *.xar
- echo Change ownerships...
- for dir in `ls -1`
- do
- chown -R -P _devdocs $dir
-
- chmod 775 $dir done
- }
- # Delete Old Docs and Copy xar to Mac Doc Direcho Operation Start.
- echo
- echo Deleting Old Mac Docsets...
- rm -rf ${
- macdocs
- }
- *.docsetecho Copying xars to
- $macdocscp Mac
- /*.xar
- $macdocs
- # Delete Old Docs and Copy xar to iOS Doc Direcho Deleting Old iOS Docsets...
- rm -rf ${iosdocs}*.docset
- echo Copying xars to $iosdocs...
- cp iOS/*.xar
- $iosdocs
-
- # Goto Mac Doc Dir and Extract Docs.
- echo Start to Extract Mac Docs...
- cd $macdocsdo_extract
- $macdocs
- # Goto iOS Doc Dir and Extract Docs.
- echo Start to Extract iOS Docs...
- cd $iosdocsdo_extract
- $iosdocsecho All Done.
You canScriptName any name, such as docsetup. sh, and grant the execution permission. Upgrade completeXcodeThen, enterDocumentDirectory, run:
Sudu./docsetup. sh Wait for a moment,DocumentAll installed.
The one aboveScriptThere is no error capture mechanism, so be cautious when using it. In addition,ScriptThe meaning is very simple. Before executing the command, you should first understandScriptWhat did you do in your system, and then decide whether to use it. Incorrect executionScriptYou are responsible for any losses, so please use them with caution. :)
Summary: DetailsXcode documentAutomatic InstallationScriptI hope this article will help you.