优胜美地
以下是一些人可能需要的新 Mac 上的一些额外步骤。这为@jnovack 的出色回答增加了一点点。
更新:设置时的其他一些注意事项:
确保您的管理员用户有密码。尝试启用 root 用户时,空白密码将不起作用。
System Preferences > Users and Groups > (select user) > Change password
然后要启用root,在终端中运行dsenableroot:
$ dsenableroot
username = mac_admin_user
user password:
root password:
verify root password:
dsenableroot:: ***Successfully enabled root user.
输入管理员用户的密码,然后输入两次新启用的root密码。
下一个类型:
sudo gcc
或
sudo make
它会回复如下内容:
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
You have not agreed to the Xcode license agreements. You must agree to
both license agreements below in order to use Xcode.
在提示显示许可协议时按 Enter。
Hit the Enter key to view the license agreements at
'/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
IMPORTANT: BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE
FOLLOWING APPLE TERMS:
//...
按q 退出许可协议视图。
By typing 'agree' you are agreeing to the terms of the software license
agreements. Type 'print' to print them or anything else to cancel,
[agree, print, cancel]
输入agree。然后它会结束:
clang: error: no input files
这基本上意味着您没有给make 或gcc 任何输入文件。
这是支票的样子:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
小牛队
在小牛队,现在有点不同了。
当工具未找到时,这是命令pkgutil 命令返回的内容:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
要安装命令行工具,这可以从终端很好地工作,带有漂亮的 gui 和一切。
$ xcode-select --install
http://macops.ca/installing-command-line-tools-automatically-on-mavericks/
当它们被发现时,这是 pkgutil 命令返回的内容:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.0.1.0.1.1382131676
volume: /
location: /
install-time: 1384149984
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
此命令在安装前后返回相同的结果。
$ pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
我之前在 xcode 的下载部分中选择并安装了 CLT 的组件,但它似乎没有进入终端...
希望对您有所帮助。