问题描述
我有一个配备OS X 10.8.2的Macbook Pro.XCode已安装.我知道,因为它出现在应用程序"目录中./usr/bin中还有xcodebuild和xcode-select文件我需要知道是否安装了命令行工具.有命令吗?我该怎么办才能查看是否已安装XCode CLT,如果可以,则可以找到已安装的版本?
I have a macbook pro with OS X 10.8.2.XCode is installed. I know this as it appears in the Applications directory.There are also the xcodebuild and xcode-select files in /usr/binI need to know if the command line tools is installed.Is there a command for it?What can I do to see if XCode CLT is installed and if yes to find the version installed?
推荐答案
10.14 Mojave更新:
请参阅优胜美地更新.
10.14 Mojave Update:
See Yosemite Update.
请参阅优胜美地更新.
请参阅优胜美地更新.
请参阅优胜美地更新.
只需在命令行中输入gcc
或make
! OSX将知道您没有命令行工具,并提示您安装它们!
Just enter in gcc
or make
on the command line! OSX will know that you do not have the command line tools and prompt you to install them!
要检查它们是否存在,xcode-select -p
将打印目录.或者,如果返回值不存在,则返回值为2
,如果不存在,则返回值为0
.只需打印返回值(感谢@Andy ):
To check if they exist, xcode-select -p
will print the directory. Alternatively, the return value will be 2
if they do NOT exist, and 0
if they do. To just print the return value (thanks @Andy):
xcode-select -p 1>/dev/null;echo $?
10.9小牛更新:
使用pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
选项1: Rob Napier 建议使用pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
,即可能更干净.
Option 1: Rob Napier suggested to use pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
, which is probably cleaner.
选项2:.在/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
内部检查对com.apple.pkg.DeveloperToolsCLI
的引用,它将列出版本4.5.0
.
Option 2: Check inside /var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
for a reference to com.apple.pkg.DeveloperToolsCLI
and it will list the version 4.5.0
.
[Mar 12 17:04] [jnovack@yourmom ~]$ defaults read /var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
{
InstallDate = "2012-12-26 22:45:54 +0000";
InstallPrefixPath = "/";
InstallProcessName = Xcode;
PackageFileName = "DeveloperToolsCLI.pkg";
PackageGroups = (
"com.apple.FindSystemFiles.pkg-group",
"com.apple.DevToolsBoth.pkg-group",
"com.apple.DevToolsNonRelocatableShared.pkg-group"
);
PackageIdentifier = "com.apple.pkg.DeveloperToolsCLI";
PackageVersion = "4.5.0.0.1.1249367152";
PathACLs = {
Library = "!#acl 1\\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C:everyone:12:deny:delete\\n";
System = "!#acl 1\\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C:everyone:12:deny:delete\\n";
};
}
这篇关于如何检查命令行工具是否已安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!