Skip to content

Instantly share code, notes, and snippets.

@brunnogomes
Created January 21, 2020 13:13
Show Gist options
  • Save brunnogomes/9dc4d2b7c601f77973cf7658e0e4c48b to your computer and use it in GitHub Desktop.
Save brunnogomes/9dc4d2b7c601f77973cf7658e0e4c48b to your computer and use it in GitHub Desktop.
Fixing XCode related errors with NodeJS, Yarn etc.
# if you get errors like:
# xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a
# command line tools instance
# or:
# xcode-select: error: command line tools are already installed, use “Software Update” to install updates
# run these if you already have XCode installed (these will config command line tools to use XCode's executables)
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
# if you don't have XCode, run these INSTEAD (these will install the standalone command line tools and config commands to use them)
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
# if by any chance you don't want to install XCode and are unable to install the command line tools using the command above, go to
# Apple Developer Downloads page (https://developer.apple.com/downloads/index.action) and log in with your Apple ID, then search and
# download the Command Line Tools package appropriate for your machine such as macOS 10.12. Aparently this is the case with macOS
# 10.15 and later, as they don't allow to install using the xcode-select command.
# Then run just the command to set them as system default:
sudo xcode-select --switch /Library/Developer/CommandLineTools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment