the Reverend
the Reverend

Reputation: 12569

change xcrun developer path

How can I change the directory at which xcrun is pointing ? currently is pointing to

xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer'. (No such file or directory)

I need to change the location. Thank you.

Upvotes: 67

Views: 67655

Answers (11)

Abel O'Ryan
Abel O'Ryan

Reputation: 4242

After uninstall xcode?

Run this in console

sudo xcode-select --reset

Upvotes: 2

Vijender Kumar
Vijender Kumar

Reputation: 1475

You do not need to have xcode installed in order to use xcrun.

Just install the xcode command line tools and switch to it.

Install x code command line tools

xcode-select --install

Switch to command line tools

sudo xcode-select --switch /Library/Developer/CommandLineTools

Upvotes: 4

Anil Gupta
Anil Gupta

Reputation: 1225

I was trying to get Git Clone through Terminal.

  1. User-Mac-mini:~ user_name$ cd /Users/yser_name/Documents/Developer/Xcode_Projects/Xcode_Proj/AAG/EJ

  2. user-Mac-mini:EJ user_name$ git clone https://smaplebitbucket.org/projectname/sample.git

I got below error:

xcrun: error: active developer path ("/Applications/Xcode 8.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)

Intially I had two xcode 7.3 and 8.0. I kept name of xcode for 7.0 and xcode 8 for 8.0.

I deleted the xcode for 7.0 from Applications and rename xcode 8 to xcode.
In Xcode preference it was poiting to location xcode 8 but it was not there.

I changed the location using command :

  sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Git Command worked and i was able to download the project from GIT.

you can also do it from Xcode preference too.

enter image description here

It worked.

Upvotes: 1

Amit Jagesha シ
Amit Jagesha シ

Reputation: 1112

Open xcode and navigate to preferences...

enter image description here

Select Location of xcode from command line tools.

enter image description here After that perform command from terminal.

Upvotes: 10

Youen Chene
Youen Chene

Reputation: 21

sudo xcode-select --switch /Library/Developer/CommandLineTools works for me.

For your information I screw up my config with this :

 sw_vers -productVersion | grep -E '^10\.([89]|10)' >/dev/null && bash -c "[ -d /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain ] && sudo -u $(ls -ld /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain | awk '{print $3}') bash -c 'ln -vs XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain' || sudo bash -c 'mkdir -vp /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain/usr && for i in bin include lib libexec share; do ln -s /usr/${i} /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain/usr/${i}; done'"

Upvotes: 0

imxylz
imxylz

Reputation: 7937

sudo xcode-select --switch /Library/Developer/CommandLineTools

Upvotes: 30

biolinh
biolinh

Reputation: 2225

If you run this command:

$ xcode-select -p

it will print to screen as below:

/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer ( in your case)

To change it to default, you can do as follow:

$ sudo xcode-select -r
Password:

Check again:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

Get more information from:

$ xcode-select

Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

Upvotes: 11

Aaron Brager
Aaron Brager

Reputation: 66292

Alternatively, override the DEVELOPER_DIR environment variable instead:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

This setting is unique to each user account. If present, it overrides the xcode-select choice.

Optional: you can make this persist between login sessions by editing your .bash_profile file.

Upvotes: 7

viktorvogh
viktorvogh

Reputation: 141

In my case, i had to:

  1. Install Xcode's command line tools, going to preferences -> Locations and setting a correct value to Command Line Tools.
  2. In Downloads -> Components tab, I clicked install on a line called Command Line tools.
  3. Marmalade started working fine with Xcode.

Upvotes: 14

Vaibhav Saran
Vaibhav Saran

Reputation: 12908

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Upvotes: 196

Rob Napier
Rob Napier

Reputation: 299545

Use xcode-select -switch to choose which version of Xcode you're using by default.

Upvotes: 45

Related Questions