Loading oh-my-bash.sh takes a long time
I recently upgraded my Mac from 11.x to 15.x. And I found that it took a lot longer for iterm2 to be ready to enter commands than before. I found that it was mainly loading the oh-my-bash.sh file. And every time I pressed enter, it would freeze.
What is the version of Bash? Could you provide the result of the following command?
$ echo "$BASH_VERSION"
https://github.com/ohmyzsh/ohmyzsh/discussions/12642 might be related, though the delay seems to have been observed there even without Oh My Zsh.
echo "$BASH_VERSION"
5.1.8(1)-release
i comment this line in ~/.bashrc, then open a new iterm tab. it will be very smooth..
#source $OSH/oh-my-bash.sh
This delay is affecting the user experience a bit now. I temporarily turn it off..
- One possibility is that the loading of
oh-my-bash.shitself takes time in your environment. Sincesource oh-my-bash.shtakes 2 seconds in your environment, we should consider this possibility. - Another possibility is that the prompt calculation by the theme you selected takes time. Since you reported that it is frozen every time Enter is pressed, this is likely the case.
- Or maybe, both of the above two problems arise in your environment.
@shuosiw What is your theme (i.e., the value of OSH_THEME in your ~/.bashrc)? Does it happen with any themes? Or does it happen with a specific theme, or does the delay depend on the theme?
Issue https://github.com/ohmybash/oh-my-bash/issues/618#issuecomment-2379884571 seems to suggest that the presence of the hg command in the system may cause the long delay.
- One possibility is that the loading of
oh-my-bash.shitself takes time in your environment. Sincesource oh-my-bash.shtakes 2 seconds in your environment, we should consider this possibility.- Another possibility is that the prompt calculation by the theme you selected takes time. Since you reported that it is frozen every time Enter is pressed, this is likely the case.
- Or maybe, both of the above two problems arise in your environment.
@shuosiw What is your theme (i.e., the value of
OSH_THEMEin your~/.bashrc)? Does it happen with any themes? Or does it happen with a specific theme, or does the delay depend on the theme?
OSH_THEME="agnoster"
I try to change to theme "font". And it looks like better than agnoster, but also has a little bit slow.
Issue #618 (comment) seems to suggest that the presence of the
hgcommand in the system may cause the long delay.
I have not install hg command.
$command hg root
-bash: hg:未找到命令
Thank you. I'd like to get the time profile of the initialization and the prompt processing.
For testing purposes, could you follow the following steps and attach the resulting file ~/.oh-my-bash/log/xtrace.agnoster.txt?
- Replace the line
OSH_THEME="agnoster"in~/.bashrcwith the following settings:
OSH_THEME="agnoster"
exec {BASH_XTRACEFD}> "$OSH/log/xtrace.$OSH_THEME.txt"
PS4='+[$EPOCHREALTIME] $BASH_SOURCE:$LINENO: '
set -x
- Start a Bash session.
- Run one command (such as 'echo hello')
- Exit the session.
- You should be able to find a file at
$OSH/log/xtrace.agnoster.txt(where$OSHis typically~/.oh-my-bash). Could you attach the file?
Thank you. I'd like to get the time profile of the initialization and the prompt processing.
For testing purposes, could you follow the following steps and attach the resulting file
~/.oh-my-bash/log/xtrace.agnoster.txt?
- Replace the line
OSH_THEME="agnoster"in~/.bashrcwith the following settings:OSH_THEME="agnoster" exec {BASH_XTRACEFD}> "$OSH/log/xtrace.$OSH_THEME.txt" PS4='+[$EPOCHREALTIME] $BASH_SOURCE:$LINENO: ' set -x 2. Start a Bash session. 3. Run one command (such as 'echo hello') 4. Exit the session. 5. You should be able to find a file at
$OSH/log/xtrace.agnoster.txt(where$OSHis typically~/.oh-my-bash). Could you attach the file?
@akinomyoga
Thank you for the results.
I extracted the time-consuming lines from the log.
For the initialization stage,
0.079887 ++++[1745213862.557008] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: wc -l
0.077763 ++++[1745213862.070317] /Users/source/.oh-my-bash/lib/functions.sh:102: grep -q '^PAGER='
0.071503 ++++[1745213862.638289] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: whoami
0.069016 +++++[1745213860.606026] /Users/source/.oh-my-bash/lib/utils.sh:151: tput colors
0.068825 +++[1745213862.738972] /Users/source/.oh-my-bash/lib/omb-prompt-base.sh:2: command git rev-parse --is-inside-work-tree
0.068263 ++++[1745213862.251200] /Users/source/.oh-my-bash/oh-my-bash.sh:125: scutil --get ComputerName
0.067875 +++++[1745213861.050578] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 3
0.066986 +++++[1745213861.823616] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 15
0.066689 +++++[1745213861.439860] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 9
0.065881 +++++[1745213861.122109] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 4
0.065827 +++++++[1745213862.390278] /Users/source/.oh-my-bash/lib/utils.sh:492: command ls --color=auto -ld -- /usr/local/bin/git
0.065680 +++++[1745213860.922649] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 1
0.065543 ++++[1745213860.533586] /Users/source/.oh-my-bash/tools/check_for_upgrade.sh:60: command rmdir /Users/source/.oh-my-bash/log/update.lock
0.064322 +++++[1745213861.189422] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 5
0.064305 ++++[1745213861.938226] /Users/source/.oh-my-bash/lib/grep.sh:5: grep --color=auto ''
0.064229 ++++[1745213860.466217] /Users/source/.oh-my-bash/tools/check_for_upgrade.sh:58: command mkdir -p /Users/source/.oh-my-bash/log/update.lock
0.063906 ++++[1745213862.149966] /Users/source/.oh-my-bash/lib/functions.sh:102: grep -q '^LESS='
0.063354 +++++[1745213861.572149] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 11
0.063035 +++++[1745213861.507901] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 10
0.062007 +++++[1745213861.697436] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 13
0.061725 +++++[1745213860.859746] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 0
0.061371 +++++[1745213861.760667] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 14
0.061327 +++++[1745213860.676045] /Users/source/.oh-my-bash/lib/utils.sh:152: tput bold
0.061223 ++++[1745213862.003948] /Users/source/.oh-my-bash/lib/grep.sh:5: grep --exclude-dir=.cvs ''
0.060339 +++++++[1745213862.329617] /Users/source/.oh-my-bash/lib/bourne-shell.sh:74: command ls --color=auto /Users/source
0.060272 +++++[1745213861.317071] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 7
0.060189 +++++[1745213861.255303] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 6
0.060074 +++++[1745213860.798452] /Users/source/.oh-my-bash/lib/utils.sh:154: tput sgr0
0.059943 +++++[1745213861.378706] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 8
0.059832 +++++[1745213860.989529] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 2
0.059297 +++++[1745213861.636757] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 12
0.059035 +++++[1745213860.738391] /Users/source/.oh-my-bash/lib/utils.sh:153: tput smul
For the genuine prompt processing,
0.087103 ++++[1745213866.778370] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: wc -l
0.071164 +++[1745213866.964541] /Users/source/.oh-my-bash/lib/omb-prompt-base.sh:2: command git rev-parse --is-inside-work-tree
0.066069 ++++[1745213866.867274] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: whoami
0.008218 +++[1745213866.769858] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:5: [[ 501 -eq 0 ]]
0.002631 +++[1745213866.765275] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:4: local CURRENT_BG=NONE
0.001814 +++[1745213866.947104] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:19: [[ -n black ]]
0.001685 ++++[1745213866.951428] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: echo 30
0.001673 +++[1745213867.035810] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: hg id
0.001664 +++[1745213866.865610] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:5: prompt_context
0.001636 +++[1745213866.953922] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:29: local -a intermediate
0.001632 ++++[1745213867.038725] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: echo 0
0.001580 +++[1745213866.942374] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:12: codes=("${codes[@]}" $(text_effect reset))
0.001473 +++[1745213866.949774] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:28: [[ blue != black ]]
0.001398 +++[1745213866.939465] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]]
0.001387 +++[1745213866.957066] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]]
0.001305 +++[1745213866.959471] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:31: PR='\[^[[0m\]\[^[[0;40m\] source@\h \[^[[30;44m\]M-nM-^BM-0'
0.001255 +++[1745213866.944976] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:14: [[ -n blue ]]
0.001226 +++[1745213867.045095] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:6: local -a reset
0.001224 +++[1745213866.933742] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:12: codes=("${codes[@]}" $(text_effect reset))
0.001222 +++[1745213867.041025] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: local -a codes
0.001209 +++[1745213866.962022] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]]
0.001164 +++[1745213866.935575] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:14: [[ -n black ]]
0.001150 +++[1745213867.043294] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:4: PR='\[^[[0m\]\[^[[0;40m\] source@\h \[^[[30;44m\]M-nM-^BM-0\[^[[0;44;30m\] \w \[^[[0;34m\]M-nM-^BM-0'
0.001063 +++[1745213867.037531] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ -n blue ]]
0.001052 +++[1745213866.937622] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:19: [[ -n default ]]
These results imply that every exec seems to take about 70 milliseconds, which is significantly slower compared to modern environments. Since there are many exec in both the initialization stage and prompt processing, these delays are accumulated and cause the observed long delay.
@shuosiw To confirm this delay is not specific in the initialization by Oh My Bash, could you provide the result of the following command (blue characters are the result in my environment)?
$ time tput setaf 1 &>/dev/null
real 0m0.002s
user 0m0.000s
sys 0m0.002s
Thank you for the results.
I extracted the time-consuming lines from the log. For the initialization stage,
0.079887 ++++[1745213862.557008] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: wc -l 0.077763 ++++[1745213862.070317] /Users/source/.oh-my-bash/lib/functions.sh:102: grep -q '^PAGER=' 0.071503 ++++[1745213862.638289] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: whoami 0.069016 +++++[1745213860.606026] /Users/source/.oh-my-bash/lib/utils.sh:151: tput colors 0.068825 +++[1745213862.738972] /Users/source/.oh-my-bash/lib/omb-prompt-base.sh:2: command git rev-parse --is-inside-work-tree 0.068263 ++++[1745213862.251200] /Users/source/.oh-my-bash/oh-my-bash.sh:125: scutil --get ComputerName 0.067875 +++++[1745213861.050578] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 3 0.066986 +++++[1745213861.823616] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 15 0.066689 +++++[1745213861.439860] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 9 0.065881 +++++[1745213861.122109] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 4 0.065827 +++++++[1745213862.390278] /Users/source/.oh-my-bash/lib/utils.sh:492: command ls --color=auto -ld -- /usr/local/bin/git 0.065680 +++++[1745213860.922649] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 1 0.065543 ++++[1745213860.533586] /Users/source/.oh-my-bash/tools/check_for_upgrade.sh:60: command rmdir /Users/source/.oh-my-bash/log/update.lock 0.064322 +++++[1745213861.189422] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 5 0.064305 ++++[1745213861.938226] /Users/source/.oh-my-bash/lib/grep.sh:5: grep --color=auto '' 0.064229 ++++[1745213860.466217] /Users/source/.oh-my-bash/tools/check_for_upgrade.sh:58: command mkdir -p /Users/source/.oh-my-bash/log/update.lock 0.063906 ++++[1745213862.149966] /Users/source/.oh-my-bash/lib/functions.sh:102: grep -q '^LESS=' 0.063354 +++++[1745213861.572149] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 11 0.063035 +++++[1745213861.507901] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 10 0.062007 +++++[1745213861.697436] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 13 0.061725 +++++[1745213860.859746] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 0 0.061371 +++++[1745213861.760667] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 14 0.061327 +++++[1745213860.676045] /Users/source/.oh-my-bash/lib/utils.sh:152: tput bold 0.061223 ++++[1745213862.003948] /Users/source/.oh-my-bash/lib/grep.sh:5: grep --exclude-dir=.cvs '' 0.060339 +++++++[1745213862.329617] /Users/source/.oh-my-bash/lib/bourne-shell.sh:74: command ls --color=auto /Users/source 0.060272 +++++[1745213861.317071] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 7 0.060189 +++++[1745213861.255303] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 6 0.060074 +++++[1745213860.798452] /Users/source/.oh-my-bash/lib/utils.sh:154: tput sgr0 0.059943 +++++[1745213861.378706] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 8 0.059832 +++++[1745213860.989529] /Users/source/.oh-my-bash/lib/utils.sh:168: tput setaf 2 0.059297 +++++[1745213861.636757] /Users/source/.oh-my-bash/lib/utils.sh:185: tput setaf 12 0.059035 +++++[1745213860.738391] /Users/source/.oh-my-bash/lib/utils.sh:153: tput smulFor the genuine prompt processing,
0.087103 ++++[1745213866.778370] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: wc -l 0.071164 +++[1745213866.964541] /Users/source/.oh-my-bash/lib/omb-prompt-base.sh:2: command git rev-parse --is-inside-work-tree 0.066069 ++++[1745213866.867274] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:1: whoami 0.008218 +++[1745213866.769858] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:5: [[ 501 -eq 0 ]] 0.002631 +++[1745213866.765275] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:4: local CURRENT_BG=NONE 0.001814 +++[1745213866.947104] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:19: [[ -n black ]] 0.001685 ++++[1745213866.951428] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: echo 30 0.001673 +++[1745213867.035810] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: hg id 0.001664 +++[1745213866.865610] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:5: prompt_context 0.001636 +++[1745213866.953922] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:29: local -a intermediate 0.001632 ++++[1745213867.038725] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: echo 0 0.001580 +++[1745213866.942374] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:12: codes=("${codes[@]}" $(text_effect reset)) 0.001473 +++[1745213866.949774] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:28: [[ blue != black ]] 0.001398 +++[1745213866.939465] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]] 0.001387 +++[1745213866.957066] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]] 0.001305 +++[1745213866.959471] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:31: PR='\[^[[0m\]\[^[[0;40m\] source@\h \[^[[30;44m\]M-nM-^BM-0' 0.001255 +++[1745213866.944976] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:14: [[ -n blue ]] 0.001226 +++[1745213867.045095] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:6: local -a reset 0.001224 +++[1745213866.933742] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:12: codes=("${codes[@]}" $(text_effect reset)) 0.001222 +++[1745213867.041025] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:3: local -a codes 0.001209 +++[1745213866.962022] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ 0 -ne 0 ]] 0.001164 +++[1745213866.935575] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:14: [[ -n black ]] 0.001150 +++[1745213867.043294] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:4: PR='\[^[[0m\]\[^[[0;40m\] source@\h \[^[[30;44m\]M-nM-^BM-0\[^[[0;44;30m\] \w \[^[[0;34m\]M-nM-^BM-0' 0.001063 +++[1745213867.037531] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:2: [[ -n blue ]] 0.001052 +++[1745213866.937622] /Users/source/.oh-my-bash/themes/agnoster/agnoster.theme.sh:19: [[ -n default ]]These results imply that every exec seems to take about 70 milliseconds, which is significantly slower compared to modern environments. Since there are many exec in both the initialization stage and prompt processing, these delays are accumulated and cause the observed long delay.
@shuosiw To confirm this delay is not specific in the initialization by Oh My Bash, could you provide the result of the following command (blue characters are the result in my environment)?
$ time tput setaf 1 &>/dev/null
real 0m0.002s user 0m0.000s sys 0m0.002s
I've tested it a few times, the longest one is the one below, and most of the others are around 0.9s
time tput setaf 1
real 0m0.102s
user 0m0.069s
sys 0m0.028s
The hardware configuration of my macOS is (Intel NUC8i5BEH):
- i5-8259U CPU
- 16G MEM
- WD SN750 500G nvme ssd
Mine is this, but I think the slow performance is due to the operating system rather than the hardware.
- cpu: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
- ram: SK Hynix 9210EE81 8 GB + Samsung 993831AF 8 GB
- disk: WDC WD20EARS-00M 1.82 TiB hdd
Previously, macOS 11.5.1 was normal, but after the major version was upgraded to 15.3.2, it became very stuck.
But on another macbook air M1, the response to execute the above tput command is very fast, basically 2-3ms
But on another macbook air M1, the response to execute the above tput command is very fast, basically 2-3ms
Thank you for this information. I tried to search if there is any information about Intel macOS, but I couldn't find any.
I also asked ChatGPT about if it can find something. ChatGPT suggested something, but they don't seem to be particularly related to the present situation that you experience. Here's my conversation with ChatGPT: slow-exec-ChatGPT.pdf.
There are 20 spawning of tput, and I think we can provide an option to skip these. Then, I think the startup time can be reduced by 1.4 sec. However, the startup would still be slow after that because many other processes are spawned in the initialization stage.
There are 20 spawning of
tput, and I think we can provide an option to skip these.
I pushed commit c8a79b6 to the master. Could you update Oh My Bash by running upgrade_oh_my_bash and put OMB_TERM_USE_TPUT=no in your ~/.bashrc (before the line source "$OSH"/oh-my-bash.sh)? Then, you can restart a Bash session to see if the situation for the initialization is improved.
- Replace the line
OSH_THEME="agnoster"in~/.bashrcwith the following settings:OSH_THEME="agnoster" exec {BASH_XTRACEFD}> "$OSH/log/xtrace.$OSH_THEME.txt" PS4='+[$EPOCHREALTIME] $BASH_SOURCE:$LINENO: ' set -x- Start a Bash session.
- Run one command (such as 'echo hello')
- Exit the session.
- You should be able to find a file at
$OSH/log/xtrace.agnoster.txt(where$OSHis typically~/.oh-my-bash). Could you attach the file?
I forgot to tell you, but you can revert the above change in ~/.bashrc after testing.
i have updated.
Updating Oh My Bash
remote: Enumerating objects: 142, done.
export OSH=/Users/source/.oh-my-bash
remote: Counting objects: 100% (142/142), done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 123 (delta 75), reused 94 (delta 56), pack-reused 0 (from 0)
接收对象中: 100% (123/123), 17.33 KiB | 4.33 MiB/s, 完成.
处理 delta 中: 100% (75/75), 完成 15 个本地对象.
来自 https://github.com/ohmybash/oh-my-bash
* branch master -> FETCH_HEAD
5f41bea..c8a79b6 master -> origin/master
更新 5f41bea..c8a79b6
Fast-forward
CONTRIBUTING.md | 2 +-
README.md | 7 +++++++
custom/aliases/example.aliases.sh | 8 ++++++++
lib/bourne-shell.sh | 17 ++++++++++++++++-
lib/utils.sh | 7 +++++--
oh-my-bash.sh | 25 +------------------------
plugins/README.md | 61 +++++++++++++++++++++++++++++++------------------------------
plugins/cargo/README.md | 3 +++
plugins/cargo/cargo.plugin.sh | 19 +++++++++++++++++++
plugins/nvm/nvm.plugin.sh | 42 ++++++++++++++++++++++--------------------
templates/bashrc.osh-template | 9 +++++++++
themes/random/README.md | 23 +++++++++++++++++++++++
themes/random/random.theme.bash | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/check_for_upgrade.sh | 2 +-
14 files changed, 200 insertions(+), 79 deletions(-)
create mode 100644 plugins/cargo/README.md
create mode 100644 plugins/cargo/cargo.plugin.sh
mode change 100644 => 100755 plugins/nvm/nvm.plugin.sh
create mode 100644 themes/random/README.md
create mode 100644 themes/random/random.theme.bash
__ __ __
____ / /_ ____ ___ __ __ / /_ ____ ______/ /_
/ __ \/ __ \ / __ `__ \/ / / / / __ \/ __ `/ ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_/ / /_/ (__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /_.___/\__,_/____/_/ /_/
/____/
Hooray! Oh My Bash has been updated and/or is at the current version.
To keep up on the latest news and updates, follow us on GitHub: https://github.com/ohmybash/oh-my-bash
and here it's my .bashrc file:
export OSH=/Users/source/.oh-my-bash
export OSH_THEME="agnoster"
export OMB_TERM_USE_TPUT=no
#OSH_THEME="font"
DISABLE_LS_COLORS="true"
completions=(
git
composer
ssh
)
aliases=(
general
)
plugins=(
git
bashmarks
)
source $OSH/oh-my-bash.sh
export LSCOLORS=gxfxcxdxbxegedabagacad
export CLICOLOR=1
export CLICOLOR_FORCE=1
bind 'TAB:menu-complete'
bind 'set show-all-if-ambiguous on'
It look like better when i open a new tab. THANKS!!
$ export OMB_TERM_USE_TPUT=no
$ time source $OSH/oh-my-bash.sh
real 0m0.555s
user 0m0.496s
sys 0m0.171s
also i try to update tput with brew, but nothing happend.
$ /usr/local/opt/ncurses/bin/tput -V
ncurses 6.5.20240427
$ time /usr/local/opt/ncurses/bin/tput setaf 1
real 0m0.082s
user 0m0.056s
sys 0m0.022s
I think another part that we can improve is these lines in the agnoster theme:
https://github.com/ohmybash/oh-my-bash/blob/2575d9f946ab317d4d06a88100b22417567455b3/themes/agnoster/agnoster.theme.sh#L432-L434
- First of all, we don't really have to use the command substitution
$()to calculate the results offg_colorandansi_single. - Also, to test whether the output of
jobshas zero lines, one doesn't need to usewc -lto count the lines. One can simply test whether the output ofjobsis empty. To do that, one can write[[ $(jobs -l) ]]. - However, the purpose of
[[ $(jobs -l | wc -l) -eq 0 ]]is test whether any jobs are running/pending. This can be simply achieved bycompgen -j 2>/dev/null.
I pushed 278d3ee. This should improve the prompt performance of the agnoster theme (Note: this doesn't affect the initialization time).
Any chance you have kubectl completion enabled? Disabling that solved it for me. #679
We already performed profiling, so we already know all the bottlenecks in the OP's situation. The kubectl completion is unrelated here.