Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal slow to start first time due to xcodebuild

The first time I run Terminal or start SmartGit either one is slow to start, taking up to ~30 seconds. When I look at the status bar for Terminal I see that it is stuck running some xcodebuild command. Not sure what exactly the command is.

Does anyone know how to view which commands Terminal runs on startup? Or if anyone else had this issue? I think it is related to this question but the slow down is only first the first startup of Terminal and for ~30 seconds. Not the 2-3 seconds users reported. Subsequent runs or commands work normally.

like image 950
Dhananjay Suresh Avatar asked Jan 22 '21 14:01

Dhananjay Suresh


2 Answers

Switch Apple Git to Git, the problem will go away.
Run brew install git to do it.
Relate link: https://blog.smittytone.net/2021/05/21/how-to-fix-xcodebuild-macos-terminal-slow-downs/

Another option is to accept the Xcode License

sudo xcodebuild -license accept

You can find this referring to the reference in the linked article.

like image 131
Quanuanc Avatar answered Oct 14 '22 11:10

Quanuanc


I've tried with sudo xcodebuild -license accept but at start the console is still very slow and, after a reboot, I have to wait at least 15s to see the terminal.

Looking around I found out that somehow it's nvm that needs xcodebuild.

The slowdown was fixed changing the nvm default to system

nvm alias default system
like image 28
freedev Avatar answered Oct 14 '22 12:10

freedev