Download all Apple open source OS X files at once

时间:2023-02-26 08:56:40

While it is well known that Mac OS X contains open source code, how to access and download that source code is perhaps less well known. Apple publishes all its open source code on their Apple Open Source site. However, this site makes you download each program individually, without an obvious option to download an entire OS X release at once (i.e., all public sources for 10.6.1).

So I wrote the following bash script to automate the download procedure. It downloads the individual tarballs for each program, expands them locally, and then rolls everything up into one big tarball for local storage. Some caveats are that this script does not build the code, and that you are bound by a variety of licenses which are not included here (because no Apple code is included here).

#!/usr/bin/env bash
# --- applesource.bash --- downloads source code for an entire Apple release # Take input from command-line (use "10.5.8", "10.6.1", etc.)
version="mac-os-x-`echo $* | tr -d "."`" # URL:
homepage="http://www.opensource.apple.com"
URL="${homepage}/release/${version}/" # Announce beginning, and prepare a directory for the untarred sources
echo "Preparing to download..."
sources="./${version}-sources"
mkdir -p ${sources} # Process the webpage for the locations of the tarballs themselves
curl --silent ${URL} | sed -n 's/<a href="\(.*.tar.gz\)">/\1/p' | \
while read line; do # Find and announce the name of the next tarball to be downloaded
tarball=".${line}"
echo -e "\nDownloading `basename ${tarball}`..." # Download the tarball and keep Apple's original directory structure intact
curl --create-dirs --output ${tarball} "${homepage}${line}" # Untar into the "sources" directory (see line 13)
tar xfz "${tarball}" -C ${sources} done # Compress all sourcefiles into a single tarball for posterity
echo "Creating ${version}.tar.gz from all sources..."
tar cfvz "${version}.tar.gz" ${sources} # Explicitly show that everything finished.
echo "Done." # I like for my Mac to talk to me, although sometimes this can be creepy.
say "The source of ${version} is now ready."

Save the above somewhere on your path, make it executable (chmod a+x scriptname), and then run it with the version number you'd like to download: getsource 10.6.1, for instance. I am a bit shy about releasing my scripts, so please be gentle!

以上转自:http://hints.macworld.com/article.php?story=20091014194517371

另附:非常有用的参考网址:
tar包下载地址(全):www.opensource.apple.com/tarballs/
source在线查看(全):www.opensource.apple.com/source/
release发布包下载地址:
Mac OS X 10.6.2: www.opensource.apple.com/release/mac-os-x-1062/
Mac OS X 10.8:   www.opensource.apple.com/release/mac-os-x-108/

脚本下载地址:http://download.csdn.net/detail/duanyipeng/8831335

Download all Apple open source OS X files at once的更多相关文章

  1. English Conversations You Can Download for Free &lpar;Spoken English MP3&sol;Audio Files&rpar;

    If you want to download free English conversations, you’ve come to the right place. This page introd ...

  2. How To Use XDOLoader to Manage&comma; Download and Upload Files&quest; &lpar;文档 ID 469585&period;1&rpar;

    Applies to: BI Publisher (formerly XML Publisher) - Version 5.6.3 to 5.6.3 [Release 5] Information  ...

  3. How To Use XDOLoader to Manage&comma; Download and Upload Files&quest; &lpar;DOC ID 469585&period;1&rpar;

    In this Document Goal Fix     Downloading Files   Uploading Files References Applies to: BI Publishe ...

  4. Install wget in Mac OS X Without Homebrew or MacPorts

    May 22, 2012 - 31 Comments The command line tool wget lets you retrieve a group of files from FTP an ...

  5. vmware 安装 Mac OS X 10&period;9 Mavericks

    This guide shows how to install fresh OS X 10.9 Mavericks on VMware workstation with Windows 7 or Wi ...

  6. 网络电话pjsip Getting Started&colon; Building for Apple iPhone&comma; iPad and iPod Touch

    Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶ Getting Started Preparation Get th ...

  7. The Top 50 Proprietary Programs that Drive You Crazy — and Their Open Source Alternatives

    The Top 50 Proprietary Programs that Drive You Crazy — and Their Open Source Alternatives 01 / 22 / ...

  8. Mac OS X 背后的故事

    Mac OS X 背后的故事 作者: 王越  来源: <程序员>  发布时间: 2013-01-22 10:55  阅读: 25840 次  推荐: 49   原文链接   [收藏]   ...

  9. openbr on linuxmint13&sol;ubuntu12&period;04&sol;debian7 x64 facial recognition &lbrack;Compile from source&excl;&excl;&excl;&rsqb;

    Openbr is a great project for facial detecting. System: linuxmint 13 x86_64 Face recognition,  motio ...

随机推荐

  1. 什么是元数据&lpar;Metadata&rpar;&quest;

    什么是元数据        任何文件系统中的数据分为数据和元数据.数据是指普通文件中的实际数据,而元数据指用来描述一个文件的特征的系统数据,诸如访问权限.文件拥有者以及文件数据块的分布信息(inode ...

  2. Sql server之路 (五)插入多条数据

    public bool GetDataUsingDataTaskReason(StationReasonCollection reason) { try { strCon.Open(); DateTi ...

  3. trie树 Codeforces Round &num;367 D Vasiliy&&num;39&semi;s Multiset

    // trie树 Codeforces Round #367 D Vasiliy's Multiset // 题意:给一个集合,初始有0,+表示添加元素,-去除元素,?询问集合里面与x异或最大的值 / ...

  4. Java学习笔记--通过java&period;net&period;URLConnection发送HTTP请求

    http://www.cnblogs.com/nick-huang/p/3859353.html 使用Java API发送 get请求或post请求的步骤: 1. 通过统一资源定位器(java.net ...

  5. IOS 跳转到系统的url

    About — prefs:root=General&path=AboutAccessibility — prefs:root=General&path=ACCESSIBILITYAi ...

  6. c&num;和java中的方法覆盖——virtual、override、new

    多态和覆盖 多态是面向对象编程中最为重要的概念之一,而覆盖又是体现多态最重要的方面.对于像c#和java这样的面向对象编程的语言来说,实现了在编译时只检查接口是否具备,而不需关心最终的实现,即最终的实 ...

  7. 7-&lpar;基础入门篇&rpar;关于STM32底层程序使用说明

    https://www.cnblogs.com/yangfengwu/p/9357695.html 基础教程源码链接请在淘宝介绍中下载,由于链接很容易失效,如果失效请联系卖家,谢谢 https://i ...

  8. Spring Boot集成Thymeleaf

    Thymeleaf是一个java类库,是一个xml/xhtml/html5的模板引擎,可以作为mvc的web应用的view层.Thymeleaf提供了额外的模块与Spring MVC集成,所以我们可以 ...

  9. delphi 连接DBF

    delphi 连接DBF 使用 DBF 文件时,文件夹表示数据库,单个 DBF 文件表示表 1.BDE,已淘汰 table1.Databasename:=dbdir;//设置库路径table1.Tab ...

  10. Python大黑阔—url采集&plus;exp验证,带你批量测试

    i春秋作家:大木瓜 前言: 最近几天在整理从各处收集来的各种工具包,大大小小的塞满了十几个G的硬盘,无意间发现了一个好几年前的0day.心血来潮就拿去试了一下,没想到真的还可以用,不过那些站点都已经老 ...