by Daniel Kehoe

Last updated 28 December 2013

How to install Apple Xcode Command Line Tools for Mac OS X 10.9 Mavericks.

Xcode is a large suite of software development tools and libraries from Apple. The Xcode Command Line Tools are part of XCode. Installation of many common Unix-based tools requires the GCC compiler.
The Xcode Command Line Tools include a GCC compiler. This article shows how to install Xcode Command Line Tools to use the GCC compiler and more.

Installing Ruby on Rails

If you are setting up your computer for developing web applications with Ruby on Rails, see this article for complete instructions:

Install Ruby on Rails – Mac OS X Mavericks

If You Are New to Rails

If you’re new to Rails, see What is Ruby on Rails?, the book Learn
Ruby on Rails
, and recommendations for a Rails tutorial.

What is the RailsApps Project?

This is an article from the RailsApps project. The RailsApps project provides example applications that developers use as starter
apps. Hundreds of developers use the apps, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal “reference implementation.” Each application is accompanied by a tutorial
so there is no mystery code. Support for the project comes from subscribers. Please accept our invitation to join the RailsApps project.

Mac OS X Mavericks

To install the newest Xcode Command Line Tools, you’ll need the latest version of Mac OS X. If you’ve owned your Mac for several years and haven’t updated Mac OS X, be prepared to spend several hours updating the operating system.

See Apple’s instructions How to upgrade to OS X Mavericks. You can install Mac OS X 10.9 (Mavericks) from the Mac
App Store for free. Allow plenty of time for the download and installation (it may take several hours).

If You Updated to Mac OS X Mavericks

If you updated to Mavericks from an earlier version of Mac OS X, and you previously installed Xcode Command Line Tools, you will need to install the new version of Xcode Command Line Tools as described here.

If you previously installed the full Xcode package, you will need to update Xcode to the newest version (Xcode 5.01 or newer). After updating Xcode, launch and run the Xcode application and accept the Apple license terms.

Terminal Application

The Terminal application or console gives us access to the Unix command
line, or shell. We call the command line the shell because it is the outer layer of the operating system’s internal mechanisms (which we call the kernel).

Find the Mac OS X Terminal application by using the Command-Spacebar combination and searching for “Terminal.” It’s in theApplications/Utilities/ folder.

Try out the terminal application by entering a shell command:

$ whoami

Don’t type the $ character.
The $ character
is a cue that you should enter a shell command. This is a longtime convention that indicates you should enter a command in the terminal application. The Unix shell command whoami returns
your username.

To learn more about Unix shell commands, read The Command Line Crash Course.

Is Xcode Already Installed?

You don’t need the full Xcode package to get the Xcode Command Line Tools. You only need the full Xcode package if you are doing development of applications for the Apple operating systems. However, you may have previously installed the full Xcode package.

Check if the full Xcode package is already installed:

$ xcode-select -p

If you see:

/Applications/Xcode.app/Contents/Developer

the full Xcode package is already installed.

You will need to update Xcode to the newest version (Xcode 5.01 or newer). Go to the App Store application and check “Updates.” After updating Xcode, be sure to launch the Xcode application and accept the Apple license terms.

If you intend to install Ruby using RVM, and you see a file location that contains spaces in the path:

/Applications/Apple Dev Tools/Xcode.app/Contents/Developer

you must delete Xcode. RVM cannot accommodate spaces in a path so RVM will
fail when you attempt to install Ruby. You can either install only the Xcode Command Line Tools (instructions below) or reinstall the full Xcode package.

Install Xcode Command Line Tools

Mac OS X Mavericks will alert you when you enter a command in the terminal that requires Xcode Command Line Tools. For example, you can enter gcc or make.

Try it. Enter:

$ gcc

You’ll see an alert box:

Click “Install” to download and install Xcode Command Line Tools.

The instructions in the alert box are confusing. You don’t need to “Get Xcode” from the App Store. Just click “Install” for the Xcode Command Line Tools.

Verify that you’ve successfully installed Xcode Command Line Tools:

$ xcode-select -p
/Library/Developer/CommandLineTools

Just to be certain, verify that gcc is
installed:

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

On earlier versions of Mac OS X, it was more difficult to install Xcode Command Line Tools. It required a huge download of the full Xcode package from the Mac App Store or registration as an Apple developer for a smaller Command Line Tools package. Mac OS X
Mavericks makes installation of Xcode Command Line Tools much simpler.

Alternatives

The OSX GCC Installer is an open source
project to provide the GCC compiler and related tools. In a recent blog post, Xcode, GCC,
and Homebrew
, the project maintainer recommends installing the Xcode Command Line Tools because the open source project is unable to duplicate the complete Apple package (notably, the Node software project isn’t supported).

Start Coding!

With the GCC compiler installed, you can install any Unix system tools you need for software development.

To install Rails, see the article Install Ruby on Rails – Mac OS X.

Want to learn Ruby on Rails? See What is Ruby on Rails?, the book Learn
Ruby on Rails
, and recommendations for a Rails tutorial.

Credits

Daniel Kehoe wrote the article.

转载自:http://railsapps.github.io/xcode-command-line-tools.html

Xcode Command Line Tools for Mac OS X 10.9 Mavericks的更多相关文章

  1. Mac appium.dmg. Xcode Command Line Tools

    You need to install the command line tools as marked in your message: ✖ Xcode Command Line Tools are ...

  2. appium----【已解决】【Mac】环境配置提示“Xcode Command Line Tools are NOT installed!"

    报错问题提示截图如下: 报错原因 :根据给出的信息很明显可以看到是"Xcode Command Line Tools"此工具没有安装 解决措施: 打开终端直接执行:xcode-se ...

  3. Xcode command line tools

    1.Xcode command line tools 安装 如果你不是一名 iOS 或 OS X 开发者,可以跳过安装 XCode 的过程,直接安装 Xcode command line tools. ...

  4. Mac OS X 10.9 Mavericks安装后,Xcode调试时模拟器黑屏的处理方法

    请耐心的等下去吧,少年! 装了Mac OS X 10.9 Mavericks的同学,如果碰到Xcode调试App时,模拟器黑屏(重置也无效),请耐心的等下去吧,大约10来分钟左右黑屏就会消失,App启 ...

  5. 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 ...

  6. Mac OS X 10.9 Mavericks 无法启动 WebStorm(PhpStorm)

    手滑把Mac的系统升到了10.9,结果机子上的PhpStorm6.0启动不了. 十分天真的重装了一次PhpStorm,问题依然没有修复. 开始怨念苹果的这次升级,毕竟以往的升级都是无缝的,升级OS就应 ...

  7. Mac OS X 10.9 Mavericks 修改root密码

    Mac10.9忘记密码后有两种方式可以进去:  代码如下 复制代码 1.sudo passwd 重新输入密码即可,此方法修改了root的密码  代码如下 复制代码 2.sudo bash 输入当前用户 ...

  8. 怎样安装Command Line Tools in OS x Mavericks&Yosemite(Without xcode)--转载

    How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode) Mac users who pre ...

  9. Xcode 8.X Command Line Tools

    Summary Step 1. Upgrade Your System to macOS Sierra Step 2. Open the Terminal Application Step 3. Is ...

随机推荐

  1. mock 数据 解决方案

    前端工程化之--Mock解决方案   https://www.jianshu.com/p/720b12b5d120 一.为什么要使用mock数据: 1.后端接口数据没有的时候,前端根据接口文档,使用 ...

  2. [NOIP模拟测试32]反思+题解

    又考挂了QAQ 总rank直接滑出前20 晚上考试脑子还算比较清醒,可惜都用来xjb乱想错误思路了. T1一眼推柿子,然而并没有头绪所以先码了个暴力.然后…… 一个垃圾暴力我调了1h,大概解决了两位数 ...

  3. 微信小程序学习笔记(二)--框架-全局及页面配置

    描述和功能 框架提供了自己的视图层描述语言 WXML 和 WXSS,以及基于 JavaScript 的逻辑层框架,并在视图层与逻辑层间提供了数据传输和事件系统,让开发者能够专注于数据与逻辑. 响应的数 ...

  4. 【Windows、SVN】在Windows服务器下安装SVN,并在客户端能维护代码版本

    1.分别在客户端和服务器端安装软件 在网上搜索一下安装包的下载地址(这里暂不介绍) 得到2个安装文件 Server是装在服务器端的,另外一个装在客户端 2.安装SVN服务器端 基本一致下一步即可 特殊 ...

  5. MySql中4种批量更新的方法update table2,table1,批量更新用insert into ...on duplicate key update, 慎用replace into.

    mysql 批量更新记录 MySql中4种批量更新的方法最近在完成MySql项目集成的情况下,需要增加批量更新的功能,根据网上的资料整理了一下,很好用,都测试过,可以直接使用. mysql 批量更新共 ...

  6. jQuery 删除行(带跨行的表格)

    jQuery 删除行(带跨行的表格) 实现效果,点击删除按钮后,在保证原来表格结构的基础上,移除当前行. 代码原理: 1.点击行后判断当前行的第一个<td>,是否包含rowspan属性,如 ...

  7. sql find_in_set在oracle下的解决方案

    比如一张表: artile (id,type,content); type:1表示文艺类,2表示小说类,3表示传记,4表示传说,等等5,6,7,8 表数据: id type content 1 3,1 ...

  8. Openstack组件部署 — keystone(domain, projects, users, and roles)

    目录 目录 前文列表 Create a domain projects users and roles domain projects users and roles的意义和作用 Create the ...

  9. python正常时间和unix时间戳相互转换的方法

    python正常时间和unix时间戳相互转换的方法 本文实例讲述了python正常时间和unix时间戳相互转换的方法.分享给大家供大家参考.具体分析如下: 这段代码可以用来转换常规时间格式为unix时 ...

  10. camunda任务的一些简单操作

    public class ZccTaskService { TaskService taskService; @Before public void init(){ ProcessEngineConf ...