Fish shell is slow, taking ~1sec every command on MacOS 10.15.6

Viewed 1444

After update XCode to 11.6 fish shell became unbearably slow. Taking ~1sec to execute every command. Regular bash was fine.

I'm running MacOS 10.15.6 with fish, version 3.0.2

XCode was upgraded from 11.3 to 11.6

eg:

~> __fish_vcs_prompt 
~> echo $CMD_DURATION
874

Almost a second!

1 Answers

Turns out the problem was caused by XCode11.6 no longer providing subversion.

Upgrading fish to version 3.1.2 fixes the problem. As svn is disabled by default in that version. brew upgrade fish (Thanks @faho for the suggestion).

Alternatively install svn:

Running below fixes the problem:

~> brew install svn
~> __fish_vcs_prompt 
~> echo $CMD_DURATION
32

How I found the problem

Running a profile of fish provided a clue:

~> fish --profile /tmp/profile -c fish_prompt; sort -nk2 /tmp/profile
...
181 12870   ---> __fish_git_prompt
1460594 1460594 -----> command svn info 2>/dev/null.
81  1460675 ----> set -l checkout_info (command svn info 2>/dev/null)
124 1462808 ---> __fish_svn_prompt
170 1478777 --> __fish_vcs_prompt
241 1481313 -> echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $fish_color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (__fish_vcs_prompt) $normal $prompt_status $suffix " "
120 1482542 > fish_prompt

1460594 1460594 -----> command svn info 2>/dev/null. Was the line where the slowdown started.

And running:

~> command svn info
svn: error: Failed to locate 'svn'.
svn: error: The subversion command line tools are no longer provided by Xcode.

Showed that XCode was nolonger providing svn

Hence the problem was fixed by installing svn via homebrew: brew install svn

Related