programing

XCode 명령줄 도구가 설치되어 있는지 확인하는 방법은 무엇입니까?

bestprogram 2023. 5. 2. 23:05

XCode 명령줄 도구가 설치되어 있는지 확인하는 방법은 무엇입니까?

OS X 10.8.2가 설치된 Macbook Pro가 있습니다. XCode가 설치되어 있습니다.응용프로그램 디렉토리에 나타나는 것으로 알고 있습니다.또한 다음과 같은 것도 있습니다.xcodebuild그리고.xcode-select에 있는 :/usr/bin명령줄 도구가 설치되어 있는지 알아야 합니다.되어 있는지 합니까?XCode CLT가 설치되어 있는지 확인하고 설치되어 있는 버전을 찾으려면 어떻게 해야 합니까?

10.15 카탈리나 업데이트:

Yosemite 업데이트를 참조하십시오.

10.14 Mojave 업데이트:

Yosemite 업데이트를 참조하십시오.

10.13 높은 시에라 업데이트:

Yosemite 업데이트를 참조하십시오.

10.12 시에라 업데이트:

Yosemite 업데이트를 참조하십시오.

10.11 El Capitan 업데이트:

Yosemite 업데이트를 참조하십시오.

10.10 요세미티 업데이트:

그들어세요가냥에 .gcc또는make 를 표시합니다!OSX는 명령줄 도구가 없다는 것을 알고 설치하라는 메시지를 표시합니다!

그들이 존재하는지 확인하기 위해,xcode-select -p디렉토리를 인쇄합니다.은 " " " " " 입니다.2만약 그들이 존재하지 않는다면, 그리고.0그들이 한다면요.반환 값을 인쇄하는 방법(감사 @Andy):

xcode-select -p 1>/dev/null;echo $?

10.9 매버릭스 업데이트:

사용하다pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

10.8 업데이트:

옵션 1: 네이피어가 사용을 제안했습니다.pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI아마 더 깨끗할 겁니다

옵션 2: 내부 확인/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist에 대한 참고로com.apple.pkg.DeveloperToolsCLI그리고 그것은 버전을 나열할 것입니다.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";
    };
}

10.10 요세미티

다음은 일부 사용자에게 필요한 새로운 Mac의 몇 가지 추가 단계입니다.이것은 @jnovack의 훌륭한 답변에 약간 더합니다.

업데이트: 이 설정 시 몇 가지 참고 사항:

admin 사용자에게 암호가 있는지 확인합니다.루트 사용자를 사용하도록 설정할 때 빈 암호가 작동하지 않습니다.

System Preferences > Users and Groups > (select user) > Change password

그런 다음 루트를 사용하려면 다음을 실행합니다.dsenableroot터미널에서:

$ dsenableroot
username = mac_admin_user
user password:
root password:
verify root password:

dsenableroot:: ***Successfully enabled root user.

admin 사용자의 암호를 입력한 다음 새 활성화된 루트 암호를 두 번 입력합니다.

다음 유형:

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

10.9 매버릭스

매버릭스와 함께라면 지금은 조금 다릅니다.

수 때 .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의 downloads 섹션에서 CLT의 구성 요소를 선택하여 설치했는데 터미널에 도착하지 못한 것 같습니다...

명령줄 도구가 설치되어 있는지 확인하려면 다음을 실행합니다.

xcode-select --version

// if installed you will see the below with the version found in your system
// xcode-select version 1234.

명령줄 도구가 설치되지 않은 경우 다음을 실행합니다.

xcode-select --install

macOS Catalina 및 일부 이전 버전에서는 다음을 사용하여 명령줄 도구가 설치된 위치를 확인할 수 있습니다.

xcode-select -p약식의xcode-select --print-path

설치된 경우 다음과 같은 응답이 표시됩니다.

/Library/Developer/CommandLineTools

설치한 버전을 확인하려면 다음을 사용할 수 있습니다.

xcode-select -v약식의xcode-select --version

그러면 다음과 같은 결과가 반환됩니다.

xcode-select version 2370.

그러나 최신 버전으로 업그레이드하려는 경우 설치된 것으로 가정하여 다음을 사용합니다.

xcode-select --install

다음과 같은 응답을 받으실 수 있습니다.

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

오히려 Spotlight find 'Software Update'를 사용해야 한다는 인상을 줍니다.실제로 터미널에서 계속 진행하고 다음을 사용해야 합니다.

softwareupdate -i -a약식의softwareupdate --install --all

이것은 가능한 모든 것을 업데이트하려고 시도하며 다음과 같이 적절하게 대응할 수 있습니다.

Software Update Tool

Finding available software
No new software available.

컴퓨터에 설치된 다양한 Apple SDK 버전을 확인하려면 다음을 사용합니다.

xcodebuild -showsdks

MacOS Sierra(10.12)에서:

  1. 다음 명령을 실행하여 CLT가 설치되어 있는지 확인합니다.

    xcode-select -p
    

    CLT가 이미 설치된 경우 도구의 경로를 반환합니다.이런 거.

    /Applications/Xcode.app/Contents/Developer
    
  2. 다음 명령을 실행하여 CLT의 버전을 확인합니다.

    pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
    

    이것은 버전 정보를 반환할 것이고, 출력은 다음과 같은 것이 될 것입니다.

    package-id: com.apple.pkg.CLTools_Executables
    version: 8.2.0.0.1.1480973914
    volume: /
    location: /
    install-time: 1486372375
    

명령줄 도구를 찾을 수 있는 가장 간단한 방법은 설치되었는지 여부와 macOS 버전과 관계없이 해당 버전입니다.

$brew config

macOS: 10.14.2-x86_64
: .1 CLT : 10.1.0.0.1.1539992718
Xcode: 10.1

명령줄 도구가 올바르게 설치되어 있고 경로가 올바르게 설정되어 있는 경우입니다.

와 같은 .
macOS: 10.14.2-x86_64
/ ACLT : 해당없음없
Xcode: 10.1

CLT는 gcc가 있음에도 불구하고 해당 없음으로 표시되어 정상적으로 작동하고 출력 미만으로 표시되었습니다.

$xcode-select -p              
/Applications/Xcode.app/Contents/Developer
$pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
$brew doctor
Your system is ready to brew.

마지막으로 xcode-select --install을 수행하여 아래와 같이 패키지 설치를 위한 CLT를 찾을 수 없는 저의 brew 문제를 해결했습니다.

Installing sphinx-doc dependency: python
Warning: Building python from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

Applications > Xcode > Preferences > downloads로 이동합니다.

설치할 명령줄 도구가 표시됩니다.

프로그래밍 관점에서 Homebrew 사람들은 다양한 파일의 존재를 확인하여 명령줄 도구가 설치되어 있는지 확인합니다.현재는 항상 다음을 확인합니다./Library/Developer/CommandLineTools/usr/bin/git그리고 또한 확인할 것입니다./usr/include/iconv.hOS 버전이 10.13 이하인 경우

터미널을 열고 Xcode가 이미 설치되어 있는지 확인합니다.

xcode-select -p

그 대가로, 만약 당신이 이것을 받는다면:

/Library/Developer/CommandLineTools

즉, Xcode가 설치되어 있습니다.

"HomeBrew"가 설치되어 있는지 확인할 수 있는 또 다른 방법은 다음 명령을 사용하여 Xcode와 버전이 있는지 확인할 수 있습니다.

brew config

그리고 마지막으로, 만약 당신이 X코드를 가지고 있지 않다면, 이 링크를 따라 앱스토어에서 X코드를 다운로드합니다.앱스토어의 Xcode입니다.

행운을 빌어요.

bash 스크립트에서 사용:

if ! command -v xcode-select &> /dev/null
then
    echo "\t xcode was not found! You need to manually install it :/ "
else
    echo "xcode is installed, checking other IOS build tools"
fi

일부 기고자들은 다음과 같이 씁니다.xcode-select -p또는xcode-select -print-path할 것입니다./Library/Developer/CommandLineToolsCLT가 설치되어 있다는 것을 의미합니다.이는 다음과 같이 실제로 정확하지 않습니다.xcode-select여러 Xcode 설치 및 CLT 간에 전환하는 데 사용할 수 있습니다.위에서 언급한 명령은 현재 사용 중인 개발 환경, 즉 어떤 Xcode 또는 CLT가 현재 사용 중인지 여부만 반환합니다.그러면 일부 설치된 Xcode에 대한 반환된 경로가 반환될 수 있으며 CLT가 실제로 설치되었는지 여부를 추론할 수 없습니다.

게다가, Apple이 디렉토리를 삭제하여 CLT를 단순히 삭제할 것을 권장하는 것처럼./Library/Developer/CommandLineTools재설치하기 전에 앞서 언급한 명령이 반환되는 것이 당연합니다./Library/Developer/CommandLineTools더 이상 설치되지 않음에도 불구하고. 의사용조차의 .pkgutil "CLT"에 "CLT"가 설치되어 ./Library/Developer/CommandLineTools이전에 간단히 삭제되었습니다.

은 따서가강기술은한입니다.xcode-select --install그리고 macOS는 경고를 통해 CLT를 설치하도록 초대할 것이며, CLT의 존재 여부만 알고 싶다면 취소할 수 있습니다.가 없는 하는 경우 " " " " " " GUI " " " 가 합니다./Library/Developer/CommandLineTools그리고.pkgutil "영수증없음."없...음▁as증..."는 수 있는 방법은 다음과 같습니다.위에서 설명한 것처럼 AFAIK의 방법입니다.예: 다음과 유사한 코드

theCLTversion=`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables 2>/dev/null | grep version`
if [ -d /Library/Developer/CommandLineTools ] && [ "$theCLTversion" != "" ]; then
    echo "CLTs $theCLTversion installed"
else
    echo "CLTs seem not to be installed"
fi

그 일을 할 수도 있습니다.그러나 저는 OS X 10.11.6(El Capitan) 이전의 이전 시스템에서 올바른 결과를 도출하기 위해 위의 스니펫을 테스트하지 않았습니다.

Xcode는 먼저 설치하면 CLI 도구를 보완하므로 10.12와 10.14에서 검증된 다음 하이브리드를 사용합니다.다른 많은 버전에서도 작동할 것으로 예상됩니다.

installed=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables 2>/dev/null || pkgutil --pkg-info=com.apple.pkg.Xcode)

소금에 절이다awk분기 논리의 맛을 보다.

물론이야.xcode-select -p에서는 매우 짧은 명령으로 변형을 처리하지만 자세한 패키지, 버전 및 설치 날짜 메타데이터를 제공하지 못합니다.

xcode-select -h 사용량: xcode-select [options]

활성 개발자 디렉토리의 경로를 인쇄하거나 변경합니다.이 디렉터리는 Xcode 명령줄 도구(예: xcodebuild)와 BSD 개발 명령(예: cc 및 make)에 사용되는 도구를 제어합니다.

옵션: -h, --help 이 도움말 메시지를 인쇄하고 exit -p, --print-path print 활성 개발자 디렉토리의 경로를 인쇄합니다. --switch set the path set the active developer directory --switch set the path set the active developer developer developer tools -v, --vers print xcode -ride version,--기본 명령줄 도구 경로로 재설정할 수 없습니다.

명령 실행xcode-select --install

이것에 대한 답은 사실 매우 간단합니다. 그리고 그 문제에 대한 어떤 응용 프로그램에 대해서도, 다시 설치해 보십시오.

설치하거나 오류가 표시됩니다. 원하지 않으면 프로세스를 중지할 수 있습니다.

단자출력

언급URL : https://stackoverflow.com/questions/15371925/how-to-check-if-xcode-command-line-tools-are-installed