Проблемы, когда я использую доморощенный
Я хочу установить git на моем Mac (OS X 10.10.3). Я пишу: brew установить git
но он сообщил:
sh: line 1: 1549 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
sh: line 1: 1552 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find otool 2> /dev/null
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
тогда пишу brew doctor. он сообщил:
Warning: /usr/local/include isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably `chown` /usr/local/include
Warning: /usr/local/lib isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably `chown` /usr/local/lib
sh: line 1: 1318 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find otool 2> /dev/null
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
тогда я chown lib и включаю в "sudo chown 755 include" "sudo chown 755 lib"
первое и второе предупреждение удаляются, но третий все еще существует.
И что меня больше смущает, что в моем finder:/usr/local/ "include" и "lib", которые должны быть папками, но становятся файлами. как я могу перенести ошибку "не могу найти otool" и установить git с помощью brew и
почему моя папка lib и include становится файлами?... спасибо за вашу помощь!
Ответы
Ответ 1
Проблема в том, что Xcode по какой-то причине не может найти свои собственные средства командной строки:
sh: line 1: 1549 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
Проверьте xcode-select --print-path
в терминале.
Если он /Applications/Xcode.app/Contents/Developer
, запустите sudo xcode-select --switch /Library/Developer/CommandLineTools
, чтобы установить xcode-select для инструментов командной строки, отличных от Xcode.
Если у вас нет каталога /Library/Developer/CommandLineTools
, вы можете получить их в https://developer.apple.com/downloads/ для текущей версии Xcode.
Ответ 2
Во-первых. Возможно, вам нужно обновить домородок перед установкой:
brew update
Во-вторых. Возможно, эта инструкция помогает (взята из Ask Different). По крайней мере, это полезно при решении вашей проблемы:
brew install git
$ git --version
git version 1.7.12.4 (Apple Git-37)
$ which git
/usr/bin/git
**// doh! osx pre-installed git trumps the brew one, so:**
$ sudo mv /usr/bin/git /usr/bin/git-apple
$ which git
/usr/local/bin/git
$ git --version
git version 1.8.2
// ok cool.