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.
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.
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
Try xcodebuild -runFirstLaunch
Then after it is complete, open up 2 new Terminal tabs.
Worked for me on macOS 12.6.
I found this solution over here: https://superuser.com/a/1742463/98148
This worked for me:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools
https://ospfranco.com/post/2021/08/05/fix-slow-terminal-start-(hanging-xcodebuild)/
I have updated brew and now iTerm2 window closes immediately. Does anyone know how to fix this?
The commands I ran were brew update and brew upgrade
I also use ZSH as my default shell. I have read now that upgrading brew and not updating zsh
can cause problems but I don't know how to get back now.
I reposted this question on AskDifferent since this is not the correct place for this.
https://apple.stackexchange.com/questions/392686/macos-brew-upgrade-causes-server-version-to-old-for-client-broken-pipe-zsh
I am a OSX user, recently I want to update my homebrew but continuing error like following
Is there anyone face such problem too?
Due to the presence of /usr/local/var/homebrew/locks/update, it seems that another homebrew update is in progress. I would start by running brew doctor and follow any instructions there. If that doesn't help, I would delete the lock file and and try to update again.
Click here to see terminal screenshot
Whenever I run the command "brew doctor" I get a response stating that I need to update Homebrew. When I then proceed to update Homebrew with "brew update" I get a response stating that Homebrew is already up to date. Is this something I should be concerned about? Is there a way to fix this? I attached a screenshot of my terminal output for clarification. Thanks in advance for the help.
I've searched around a bit and can't seem to find any record of anyone else with this problem.
Whenever I try to run
$ brew update
I am rewarded with
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
This isn't my machine and I normally develop on Linux systems so this is all a bit odd to me.
Any help would be greatly appreciated! Please tell me if there is any additional info I should provide. Again, I'm not used to homebrew or OSX.
EDIT
at the request of JameA
xiao:~ patrick$ brew doctor
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
xiao:~ patrick$ brew --config
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
...Not sure I like this whole "here, use this macbook for the project, it works better" thing...
I'm pretty sure the root cause of this is a failed upgrade attempt to Homebrew 0.9.5 from a much earlier version. Basically, if you run brew update as opposed to sudo brew update a portion of files are updated, while others are not. Here's what worked for me:
Edit /usr/local/bin/brew (it's just a Ruby file, not a compiled binary, so any text editor will do). You'll find a block like:
if MACOS and MACOS_VERSION < 10.5
abort <<-EOABORT.undent
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
EOABORT
end
Comment this out. Even if you don't know Ruby, you can probably intuit what this is doing—it's checking to see if you have a current version of OSX. Assuming that you do in fact have this version, this sanity check isn't necessary. Brew is still broken, but at least now it will load far enough to give error messages.
Run sudo brew update, spoiler alert: it fails, but this time with a meaningful error message:
$ brew update
error: Your local changes to the following files would be overwritten by merge:
[giant list of files here]
Well, today I learned that brew update is just a wrapper for git pull because anyone who has worked with git knows that error message. We can fix this too.
Switch into the homebrew git repository with cd /usr/local and give the command git reset --hard FETCH_HEAD.
This piece found here.
Give the command sudo brew update. Homebrew should now update successfully and work properly!
Once the system is working again, you can actually kind of see why an error like this would have occurred. For one, usr/local/bin/brew has been completely rewriten and isn't even Ruby anymore, and most of its configuration has been moved into /usr/local/Library/brew.rb which no longer uses the constants MACOS or MACOS_VERSION constants, as they have been replaced by the more object oriented OS.mac and MacOS.version.
The MACOS constant is set in globals.rb. It seems like you may have a borked installation of Homebrew.
Check the output of brew doctor for any suggestions.
If that doesn't help please update with the results of brew --config.
If all else fails you may want to try re-installing Homebrew.
UPDATE:
Since this was a previous user's machine make sure your user is the owner of /usr/local and everything within. Fix it with sudo chown -R $USER /usr/local.
I had a similar issue, when I Killed an install mid-way with Ctrl-D.
Post that whenever I tried installing anything it gave the following error
uninitialized constant Homebrew::CLI::Parser::ARGV_WITHOUT_MONKEY_PATCHING
As a fix, I went to the directory I had where homebrew was installed, and reset the HEAD.
cd /usr/local/Homebrew
git status
git checkout .
And then it started working magically.
I had a similar error with a "borked" installation of brew. I removed the small 5 line block of code in the /usr/local/bin/brew script starting with the MACOS line. That did the trick to allow me to uninstall and eventually reinstall it.
In addition to Matt Korostoff's answer.
On point 3 (resetting the repo), for recent version of Homebrew, the repo is no longer /usr/local, do cd "$(brew --repo)" instead.