xcode-select -switch doesn't work: active deve

2019-04-06 13:00发布

I have installed Xcode 5 developer preview 3. Before it i had developer preview 2 and now, sometimes in my terminal I see error, for example when I try to autocomplete some commands by tab:

error: active developer path ("/Applications/Xcode5-DP2.app/Contents/Developer") does not exist, use xcode-select to change

I try to change this directory by executing command:

sudo xcode-select -switch /Applications/Xcode5-DP3.app/Contents/Developer

Now xcode has correct path because command

sudo xcode-select -print-path

shows me result:

 /Applications/Xcode5-DP3.app/Contents/Developer    

but I still see the same error in terminal, see attached: https://dzwonsemrish7.cloudfront.net/items/120Z1S0b1Q302w3J453U/Screen%20Shot%202013-07-24%20at%2016.34.23.png?v=45e9961b

标签: macos xcode5
5条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-04-06 13:33

If you are running beta release. Path should be look like this.

sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developer
查看更多
我只想做你的唯一
3楼-- · 2019-04-06 13:34

Try changing the path in xcode itself. enter image description here

查看更多
贼婆χ
4楼-- · 2019-04-06 13:34

If you do a:

man xcode-select

It tells you to use the path as:

xcode-select /Application/Xcode-DP4.app

As I've just switched to DP4 to test. That worked for me. I didn't see it point to any of the .app contents. I guess this was probably changed from previous versions...

查看更多
萌系小妹纸
5楼-- · 2019-04-06 13:42

I've got this error after I change the name of Xcode app. I changed Xcode app to Xcode8.1.app. Then I run command

sudo xcode-select -switch /Applications/Xcode8.1.app/Contents/Developer

and now everything work as beginning.

Not sure are you in my case and your problem is solved or not. Maybe help another one.

查看更多
Fickle 薄情
6楼-- · 2019-04-06 13:52

It happened to me once: xcode-select -print-path did stick to the same value and wasn't changing. It appeared that it was always equal to DEVELOPER_DIR environment variable. According to the manpage of xcode-select:

When DEVELOPER_DIR is set, its value will be used instead of the value last passed to -switch xcode_path

So, unsetting DEVELOPER_DIR makes xcode-select -switch working.

查看更多
登录 后发表回答