我在山狮上试过这个。让我知道如果你有任何问题或 不能在小牛队得到类似的工作。我记得当我没有自己的 ,并且无法在学校安装软件时,学习使用电脑的巨大痛苦。
此过程将启动并运行make和基本C 编译器。
首先,从https://developer.apple.com/downloads下载“Xcode - 2013年10月的命令行工具(OS X Mountain Lion)”包。您需要注册并使用Apple ID登录,但您无需支付任何费用。
然后,你打开DMG之后,解压里面的文件到你的主目录和工具添加到您的$PATH:
$ mkdir -p ~/tmp ~/opt/devtools
$ cd ~/tmp
$ tar xf '/Volumes/Command Line Tools (Mountain Lion)/Packages/DeveloperToolsCLI.pkg'
$ tar xf Payload
$ tar xf '/Volumes/Command Line Tools (Mountain Lion)/Packages/DevSDK.pkg'
$ tar xf Payload
# Ignore the error messages!
$ mv usr System Library ~/opt/devtools
$ echo 'export PATH="${PATH}:${HOME}/opt/devtools/usr/bin"' >> ~/.bash_profile
现在打开一个新的终端,并尝试一下!
$ echo '#include
int main() {
printf("Hello, world!\n");
return 0;
}' > foo.c
$ CFLAGS=-I"${HOME}/opt/devtools/usr/include" make foo
cc -I/Users/test/opt/devtools/usr/include foo.c -o foo
$ ./foo
Hello, world!
所有基本的C的东西应该工作。一些苹果专用的东西可能需要 摆弄搜索路径,或者可能根本不起作用,但现在你在路上 。
祝你好运!