Download all Apple open source OS X files at once
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的更多相关文章
- English Conversations You Can Download for Free (Spoken English MP3/Audio Files)
If you want to download free English conversations, you’ve come to the right place. This page introd ...
- How To Use XDOLoader to Manage, Download and Upload Files? (文档 ID 469585.1)
Applies to: BI Publisher (formerly XML Publisher) - Version 5.6.3 to 5.6.3 [Release 5] Information ...
- How To Use XDOLoader to Manage, Download and Upload Files? (DOC ID 469585.1)
In this Document Goal Fix Downloading Files Uploading Files References Applies to: BI Publishe ...
- 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 ...
- vmware 安装 Mac OS X 10.9 Mavericks
This guide shows how to install fresh OS X 10.9 Mavericks on VMware workstation with Windows 7 or Wi ...
- 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch
Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶ Getting Started Preparation Get th ...
- 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 / ...
- Mac OS X 背后的故事
Mac OS X 背后的故事 作者: 王越 来源: <程序员> 发布时间: 2013-01-22 10:55 阅读: 25840 次 推荐: 49 原文链接 [收藏] ...
- openbr on linuxmint13/ubuntu12.04/debian7 x64 facial recognition [Compile from source!!!]
Openbr is a great project for facial detecting. System: linuxmint 13 x86_64 Face recognition, motio ...
随机推荐
- reserve的使用
reserve: 强迫容器将它的容量变成n 可以避免不必要的重新分配 如果n大于当前容量,那么正常. 如果n小于当前容量,vector会忽略,string则是减小为 max(size(),n). 如果 ...
- [BZOJ]4197: [Noi2015]寿司晚宴
Time Limit: 10 Sec Memory Limit: 512 MB Description 为了庆祝 NOI 的成功开幕,主办方为大家准备了一场寿司晚宴.小 G 和小 W 作为参加 NO ...
- [BZOJ]4810: [Ynoi2017]由乃的玉米田
Time Limit: 30 Sec Memory Limit: 256 MB Description 由乃在自己的农田边散步,她突然发现田里的一排玉米非常的不美.这排玉米一共有N株,它们的高度参差 ...
- python nonloacal
Python 3 添加了 nonlocal 关键字,把 None.True 和 False 提升为关键字,废弃了 print 和 exec.今天细说下 nonlocal 的用法 nonloacal是最 ...
- spine - unity3D(摘自博主softimagewht)
摘自:(博主 http://www.cnblogs.com/softimagewht/p/4149118.html) //skeletonDataSkeletonAnimation skeletonA ...
- Python中的条件和循环语句
条件和循环语句 1. 条件语句 if单用 格式:if 条件表达式 例如:if 5 > 3: print('True') >>> 'True' #当条件满足时才会执行上述操作. ...
- jquery easyui datagrid数据自动换行 panel用法
nowrap:false 初始化panel $('#txtLeftPercent').panel({ title: '剩余权重:' + percent, height: 10, width: 180, ...
- 去掉textarea和input在ios下默认出现的圆角
-webkit-appearance:none;/*清除ios默认圆角*/ border-radius:0;
- Python盗号原理-代码实现截屏键盘记录远程发送(不要做坏事)
这年头盗号的从出不穷,不是脱裤就是社工钓鱼.今天呢我们就以前面的几篇技术文章做铺垫,来讲一下python盗号的原理(学习用途,请勿用于违法犯罪),知己知彼方能百战不殆嘛. 脱裤我们就不多提了,无非就是 ...
- 网站用户身份识别俩大招之cookie
导航: 原理介绍 代码实现 过程分析 追踪Cookie 原理介绍 众所周知,http协议是无状态的协议,简单理解是用户的前一步操作和后一步操作之间没有关系,互相不知道,不干扰.而在很多场景下,浏览网页 ...