138

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?

4
  • 2
    I am curious on how to make the update unattended instead of diabling it.
    – sorin
    Commented Nov 29, 2018 at 11:09
  • It's not only annoying. It just obliterated my original .zshrc file without even making a back-up. Commented Feb 12, 2020 at 17:32
  • 1
    @sorin Three years later, here it is. Refer to my answer below. zstyle ':omz:update' mode auto
    – om-ha
    Commented Dec 10, 2021 at 21:53
  • This answer is outdated.
    – Severisth
    Commented Jun 10 at 16:34

5 Answers 5

194

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.

5
  • 2
    Is there a way to make the prompt less frequent without disabling it?
    – Dave
    Commented Jun 7, 2016 at 20:42
  • 25
    There is a UPDATE_ZSH_DAYS variable as well. That accepts an integer to specify a frequency in days.
    – RedBassett
    Commented Jun 16, 2016 at 23:54
  • 2
    (as of this comment) All of these settings are now available in your ~/.zshrc (with comments!).
    – AlG
    Commented Jan 18, 2021 at 14:08
  • 3
    DISABLE_UPDATE_PROMPT=true should be the default out of box. I probably will ditch ohmyzsh one day b/c of this anoyance.
    – KFL
    Commented Dec 7, 2021 at 0:39
  • UPDATE_ZSH_DAYS's default is 13 days. Set it like UPDATE_ZSH_DAYS=30 to make it less frequent.
    – Mohsenasm
    Commented May 17 at 17:01
119

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.

0
49

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

7
  • 1
    How interesting! I wonder if there's any functional or performance difference between using zstyle or environment variables in .zshrc Commented Dec 2, 2021 at 1:39
  • 1
    @flyingsandwich 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.
    – om-ha
    Commented Dec 2, 2021 at 11:48
  • I will update my answer accordingly, I was not aware the environment variables method was deprecated. Thanks!
    – om-ha
    Commented Dec 2, 2021 at 11:49
  • 1
    One extra functional difference is: Unlike variables they can be different in different contexts and unlike shell options they can take values (source)
    – om-ha
    Commented Dec 2, 2021 at 12:44
  • 1
    Oh the docs here answer my questions actually: github.com/ohmyzsh/ohmyzsh/wiki/Settings#update-settings. Default is "prompt" and reminder is just a reminder
    – mowwwalker
    Commented Jun 2, 2022 at 15:57
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.

0

I have set an update on background. My crontab:

0 0 * * 0 /bin/zsh -i -c 'omz update' >/dev/null 2>&1

Not the answer you're looking for? Browse other questions tagged or ask your own question.