change xcrun developer path
Asked Answered
T

11

67

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.

Thermistor answered 12/7, 2012 at 17:3 Comment(0)
H
196
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Habitable answered 1/10, 2012 at 12:32 Comment(1)
This is interesting: This changes xcode version system wise, is it possible to select during specific build in progress...? I have use case where parallel builds are running ... System wide changes will not helpful for me..Waw
E
45

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

Elicia answered 12/7, 2012 at 17:11 Comment(2)
On OSX Yosemite use xcode-select --switch path/to/Xcode.app.Anorak
please try this 1.xcode-select --install 2.sudo xcode-select -switch /Applications/Xcode.app/Contents/DeveloperPhemia
T
30
sudo xcode-select --switch /Library/Developer/CommandLineTools
Totality answered 5/11, 2014 at 3:1 Comment(1)
This was it for me. When I uninstalled xcode from my mac git wasn't working anymore. I just executed this line and everything was fine without installing xcode again.Therein
P
14

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.
Panic answered 17/10, 2012 at 10:0 Comment(1)
This was the answer for me, and you if you don't have the command line tools set.Serle
A
11

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
Anzovin answered 17/6, 2014 at 4:50 Comment(0)
M
10

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.

Melodramatize answered 2/8, 2016 at 3:53 Comment(0)
D
7

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.

Dominick answered 17/3, 2013 at 0:22 Comment(0)
B
4

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
Brisance answered 19/5, 2020 at 4:17 Comment(0)
H
2

After uninstall xcode?

Run this in console

sudo xcode-select --reset
Holt answered 29/9, 2020 at 14:49 Comment(0)
V
1

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.

Virtues answered 19/1, 2017 at 12:20 Comment(0)
E
0

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'"
Eryneryngo answered 23/2, 2015 at 15:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.