Iterm window closes upon start after having ran brew update && brew upgrade (using zsh on Mac) - macos

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

Related

How to fix Mac terminal being incredibly slow after brew install tmux

I've installed tmux using brew ( arch -x86_64 brew install tmux ) on M1 Mac and since then my terminal is super slow. on lunch, after running commands and it's just incredibly slow.
I tried deleting the package using
brew uninstall pkg
it didn't work. I tried using the following commands as well.
brew remove pkg
brew rmtree tmux
I get "Error: tmux is not currently installed" since I've already uninstalled it..
and when using
sudo find / -name "*tmux*"
I still get many files including tmux.
GIFs showing the situation
any ideas/help on how to solve this?
Ok I have fixed it.
although I didn't know exactly what was the problem but it was something related to oh-my-zsh and to be more specific it was with the current oh-my-zsh theme powerlevel9k after installing tmux.
here is the steps I toke: I tried to change my shell to bin/bash it worked great. Tried a couple more shells and all worked great except zsh. then I tried to change the .oh-my-zsh directory name just for testing purposes and opened zsh, it worked great but of course without oh-my-zsh.
so I went to .zshrc and commented this line.
#ZSH_THEME="powerlevel9k/powerlevel9k"
obviously installing tmux messed things up so I'll need to reinstall the theme or oh-my-zsh all over again.

brew update (homebrew) take a lot of time to run

I am a new mac user,
and I just installed HomeBrew to set up my computer for business use,
but every time I run a brew command,
brew update
is started automatically and takes a lot of time,
I have time to do what I want before it works!
please be indulgent with me and teach me a way to solve my problem
I want to clarify that I do not have a network problem because everything works correctly on this side.
Thank you.
Add the following config into your shell init files. (.bash_profile for Bash, .zshrc for ZSH)
export HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_NO_AUTO_UPDATE: If set, Homebrew will not auto-update before running brew install, brew upgrade or brew tap.

How to install a specific version of vim (+clipboard)

I'm trying to enable copying to OSX's clipboard in vim and most resources I have found say that I need a version of vim with +clipboard. These resources also indicate that this should be as easy as running brew install vim, however, I am stuck with -clipboard even after updating. Any suggestions as to how to force this feature? Do I even need it to achieve the desired behavior?
a brew update brew install vim should give you vim with +clipboard.
However your path probably still points to the old vim. Try that:
alias vim="/usr/local/bin/vim"
probably this will also work: (Not anymore, see the Update)
brew install vim --with-override-system-vim
Addition: I recommend to install it with brew install vim --with-client-server so you will have +xterm_clipboard.
Alternativly you could install macvim which should have all these features already in:
brew install macvim --with-override-system-vim
Update
--with-override-system-vim was removed. The best solution in my opinion is to just add macvim in front of your PATH:
PATH="/Users/user/Applications/MacVim.app/Contents/MacOS/Vim:${PATH}"
export PATH
You can test if vim points to the right instance with which vim

How to revert to system vim after using installing vim with homebrew?

I wanted to upgrade to vim 7.4+ but the macOS system version was 7.3. I used the command brew install vim --override-system-vim however I don't think overriding system defaults is ever a good idea. How can I revert the changes back to the system defaults?
Just remove /usr/local/bin/vi (which is a symbolic link to brew's vi).
Run brew rm vim && brew install vim.
Making the symbolic link is all what --override-system-vim do.
Brew actually doesn't do anything with system vi.

How do I get autochdir to work on a Mac when running Vim from the terminal?

In MacVim autochdir works without a problem. However, lately I've been running iTerm2 (full screen with split) for coding and the lack of autochdir is really bothering me. Any solutions? Thanks.
What do you mean by "the lack of autochdir"? It works fine both in CLI and in GUI.
If you have set autochdir in your ~/.vimrc this feature will work the same way whether you are in MacVim or iTerm2 or Terminal or whatever.
But I suspect you are changing dirs in an iTerm2 split and expecting Vim to somehow learn about that change and change its pwd accordingly. Am I right? "Unfortunately" Vim doesn't know about the second iTerm2 split and can't react to your cd there.
In the terminal:
> which vim
If it says /usr/bin/vim, you're using the mac base installation. This is an old version of vim and doesn't support autochdir. You'll need a newer version.
Check if you have another installation of vim by running:
> /usr/local/bin/vim
If so, add /usr/local/bin to your $PATH before /usr/bin
If not, install it:
> brew install vim

Resources