Oh My Zsh - Disable 'Would you like to check for updates' prompt
Asked Answered
S

5

134

Every time I open up terminal on a Mac I get the prompt

Would you like to check for updates?

I find it quite annoying. Anyway to stop it from doing so?

Selle answered 7/7, 2012 at 21:2 Comment(3)
I am curious on how to make the update unattended instead of diabling it.Mute
It's not only annoying. It just obliterated my original .zshrc file without even making a back-up.Autocephalous
@Mute Three years later, here it is. Refer to my answer below. zstyle ':omz:update' mode autoBoogiewoogie
L
118

You have to add DISABLE_AUTO_UPDATE="true" on your .zshrc before the source $ZSH/oh-my-zsh.sh line. By doing so, oh-my-zsh will just skip the update checking script.

Lavine answered 7/7, 2012 at 21:17 Comment(0)
P
190

Set environment variable DISABLE_UPDATE_PROMPT=true to always reply Yes and automatically upgrade.

Set environment variable DISABLE_AUTO_UPDATE=true to always reply No and never upgrade.

Simply add one of these in your ~/.zshrc somewhere before calling source $ZSH/oh-my-zsh.sh.

Porphyroid answered 16/9, 2014 at 18:54 Comment(4)
Is there a way to make the prompt less frequent without disabling it?Highclass
There is a UPDATE_ZSH_DAYS variable as well. That accepts an integer to specify a frequency in days.Neckpiece
(as of this comment) All of these settings are now available in your ~/.zshrc (with comments!).Eloign
DISABLE_UPDATE_PROMPT=true should be the default out of box. I probably will ditch ohmyzsh one day b/c of this anoyance.Precincts
L
118

You have to add DISABLE_AUTO_UPDATE="true" on your .zshrc before the source $ZSH/oh-my-zsh.sh line. By doing so, oh-my-zsh will just skip the update checking script.

Lavine answered 7/7, 2012 at 21:17 Comment(0)
B
45

Deprecation in some other answers

Other answers might reference deprecated method for updating the settings.

As per OhMyZsh wiki, there is a section talking about Deprecated settings.

These settings are still supported but will be removed in a future version of Oh My Zsh. Migrate to the zstyle settings while you still can.

For example, the following two methods achieve the same result:

A. Deprecated method for modifying Settings (Environment Variable in .zshrc)

DISABLE_AUTO_UPDATE=true

B. Recommended method for modifying Settings (zstyle Setting)

zstyle ':omz:update' mode disabled

I'm surprised no one mentioned the new and fine-tuned controls over OhMyZsh updates, that deprecates the old method.

This of course does not prevent you from invoking zstyle from .zshrc.

You can try the following commands that are stated by OMZ docs:

OMZ Docs -- Getting Updates

You have several options to tweak OMZ updates.

  • By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by adding a line to your ~/.zshrc file, before Oh My Zsh is loaded:

  • Automatic update without confirmation prompt:

zstyle ':omz:update' mode auto
  • Just offer a reminder every few days, if there are updates available:
zstyle ':omz:update' mode reminder
  • To disable automatic updates entirely:
zstyle ':omz:update' mode disabled
  • NOTE: you can control how often Oh My Zsh checks for updates with the following setting:
# This will check for updates every 7 days
zstyle ':omz:update' frequency 7
# This will check for updates every time you open the terminal (not recommended)
zstyle ':omz:update' frequency 0

IMPORTANT (zstyle precondition)

  • Do note, the commands above (zstyle) have to be executed strictly from within an OhMyZsh shell.
  • In other words, after installing ZSH and OhMyZsh, maybe you decided not to change your default shell to ZSH.
  • In that particular case, you have to switch your shell temporarily to ZSH for the above commands to work. You can do that with exec /bin/zsh, this probably applies to .zshrc as well.

Understanding zstyle

Boogiewoogie answered 1/11, 2021 at 19:15 Comment(7)
How interesting! I wonder if there's any functional or performance difference between using zstyle or environment variables in .zshrcLyda
@Lyda that's a good question, I'm not aware of any performance differences. But for functional, using environment variables in .zshrc is deprecated and will be removed in the future. zstyle is encouraged to be used instead. Here's the source for that. Note, that you can invoke and sprinkle zstyle in your .zshrc file.Boogiewoogie
I will update my answer accordingly, I was not aware the environment variables method was deprecated. Thanks!Boogiewoogie
One extra functional difference is: Unlike variables they can be different in different contexts and unlike shell options they can take values (source)Boogiewoogie
The docs leave me with a couple questions - what's the default, zstyle ':omz:update' frequency 7? Does the "reminder" mean the update prompt or just a message the prints when you open a shell?Marathi
Oh the docs here answer my questions actually: github.com/ohmyzsh/ohmyzsh/wiki/Settings#update-settings. Default is "prompt" and reminder is just a reminderMarathi
Exactly @mowwwalker. reminder is different from the prompt as the former is non-intrusive. I think reminder should be the default. No clue why they thought it was a good idea for the prompt to be the default.Boogiewoogie
S
0

Go to ~/.oh-my-zsh/tools/check-for-upgrade.sh and replace all contents of this file with

true;

Everything else seems to be unreliable.

Standing answered 18/10, 2023 at 9:22 Comment(0)
B
0

I have set an update on background. My crontab:

0 0 * * 0 /bin/zsh -i -c 'omz update' >/dev/null 2>&1
Boni answered 2/1 at 17:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.