-
-
Notifications
You must be signed in to change notification settings - Fork 25.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please, oh please, ask, or at least warn, about overwriting ~/.zshrc on installation #4390
Comments
It copies the old .zshrc to |
Right, and if the installer runs twice, the backup is nuked. A warning anywhere, especially in the installation notes, would be a service to new users. |
I think a good fix for this (including the note that this will overwrite) would be to backup the .zshrc in a logfile type rotation. Or we could just instead backup to |
Any chance of getting this fixed, 4 years later? |
Hey @afeinman it's been a long journey but I finally got there! I pull @apjanke's fix in #5169 and it's now ready for testing. If you want to help speed up the testing and merge (which should happen early next week), you can wget or curl it from the URL Thanks! |
Closed by #5169. |
This is still a problem. |
.zshrc still got overwritten in 2022. Amazing. Just amazing |
It has to get overwritten to work. Didn’t it make a backup copy first? |
For those that are here and want to not have their zshrc get overriden: see this comment #8209 (comment). Or if you're too lazy to click: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --keep-zshrc |
I let my former boss install oh-my-zsh and it overwrote all of his many macros, especially the ones to prod db/server/etc... it's a pity I didn't google this page back then :X |
The old file is renamed to |
That's only true the first time you run it. :) If you rerun the installer, say, because you wanted to take a different path, or something didn't go the way you expect, then that backup is obviously overwritten with the first oh-my-zsh's contents—in other words, deleted. This is what I was expressing in my first reply above. The simplest possible mitigation is to check whether a backup has already been created before writing, so that different behavior can be invoked—maybe prompting the user, or picking some additional, unique, suffix. Obviously, as a user, it's my responsibility to back up my data; but, in my defense, the installer doesn't (or didn't, back when I filed the issue) warn you that your |
I'll carry that. We should backup as many zshrc as needed. Thanks for the report! |
It looks like #5169 actually fixed this issue: This check is basically exactly what I had in mind. You could theoretically still lose data by running multiple installers per second, but there's only so much a developer can do to save us from ourselves. |
To be extra explicit about the current behavior, this is what happens:
I understand the current behavior is confusing, but all this information is printed on the screen while the installer is running, so please pay attention to the messages. |
You're right! Looks like it was fixed in 43b3126 over three years ago. Maybe @tasdflkjweio, @Julianouyang, & @kris-jobs can find their backed-up copies then? |
Documented this in https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#my-zshrc-file-was-deleted-on-install. |
Why can't omyzsh simply have it's own conf file and just add itself to the main one somehow, saving it to a backup is better than only overwriting it but why would restoring something from a backup ever be part of a decent installation process anyway? Not super familiar with the best practicies of cli stuff but it seems like a very backwards and confusing approach... |
amazing still overwrites the source! Give a Heads up! |
This seems like the obvious thing to do, wonder why this less intuitive approach of discarding the users config was chosen |
Please add markers around when editing Opened #12330 |
Why did you lose it? OMZ makes a backup copy of it |
Today is a little worse than it was before installing oh-my-zsh.
The text was updated successfully, but these errors were encountered: