How do you “disable” oh-my-zsh (and zsh) without uninstalling it?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








14















I was trying new dev environments including zsh and oh-my-zsh. Now that I have installed oh-my-zsh, it starts by default on my terminals (iTerm2 and terminal) always start with zsh and with the settings on from oh-my-zsh. I was wondering if it was possible to "disable" or stop using zsh and its setup with oh-my-zsh without having to uninstall oh-my-zsh? It would also be nice to know how to turn them back on too.



Currently, my terminals goes into zsh automatically (I think) and use the oh-my-zsh automatically. I want to have more control over that and me able to control both, when the zsh is being used and when the oh-my-zsh features are being used.



One thing I am also interested on knowing is, how do the terminal applications know which shell to start running on start up. That would be nice to be able to control too!



If you explain as much as you can of the "why" of every command you give me, that would useful! :)




I am on OS X. Not sure if that matters, but I tend to like answers more that are more applicable to more general Unix environments rather to my own.










share|improve this question
























  • you want to stop using zsh? or oh-my-zsh? which?

    – strugee
    Jun 15 '14 at 3:12











  • either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

    – Charlie Parker
    Jun 15 '14 at 3:21

















14















I was trying new dev environments including zsh and oh-my-zsh. Now that I have installed oh-my-zsh, it starts by default on my terminals (iTerm2 and terminal) always start with zsh and with the settings on from oh-my-zsh. I was wondering if it was possible to "disable" or stop using zsh and its setup with oh-my-zsh without having to uninstall oh-my-zsh? It would also be nice to know how to turn them back on too.



Currently, my terminals goes into zsh automatically (I think) and use the oh-my-zsh automatically. I want to have more control over that and me able to control both, when the zsh is being used and when the oh-my-zsh features are being used.



One thing I am also interested on knowing is, how do the terminal applications know which shell to start running on start up. That would be nice to be able to control too!



If you explain as much as you can of the "why" of every command you give me, that would useful! :)




I am on OS X. Not sure if that matters, but I tend to like answers more that are more applicable to more general Unix environments rather to my own.










share|improve this question
























  • you want to stop using zsh? or oh-my-zsh? which?

    – strugee
    Jun 15 '14 at 3:12











  • either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

    – Charlie Parker
    Jun 15 '14 at 3:21













14












14








14


6






I was trying new dev environments including zsh and oh-my-zsh. Now that I have installed oh-my-zsh, it starts by default on my terminals (iTerm2 and terminal) always start with zsh and with the settings on from oh-my-zsh. I was wondering if it was possible to "disable" or stop using zsh and its setup with oh-my-zsh without having to uninstall oh-my-zsh? It would also be nice to know how to turn them back on too.



Currently, my terminals goes into zsh automatically (I think) and use the oh-my-zsh automatically. I want to have more control over that and me able to control both, when the zsh is being used and when the oh-my-zsh features are being used.



One thing I am also interested on knowing is, how do the terminal applications know which shell to start running on start up. That would be nice to be able to control too!



If you explain as much as you can of the "why" of every command you give me, that would useful! :)




I am on OS X. Not sure if that matters, but I tend to like answers more that are more applicable to more general Unix environments rather to my own.










share|improve this question
















I was trying new dev environments including zsh and oh-my-zsh. Now that I have installed oh-my-zsh, it starts by default on my terminals (iTerm2 and terminal) always start with zsh and with the settings on from oh-my-zsh. I was wondering if it was possible to "disable" or stop using zsh and its setup with oh-my-zsh without having to uninstall oh-my-zsh? It would also be nice to know how to turn them back on too.



Currently, my terminals goes into zsh automatically (I think) and use the oh-my-zsh automatically. I want to have more control over that and me able to control both, when the zsh is being used and when the oh-my-zsh features are being used.



One thing I am also interested on knowing is, how do the terminal applications know which shell to start running on start up. That would be nice to be able to control too!



If you explain as much as you can of the "why" of every command you give me, that would useful! :)




I am on OS X. Not sure if that matters, but I tend to like answers more that are more applicable to more general Unix environments rather to my own.







zsh oh-my-zsh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 15 '14 at 3:52







Charlie Parker

















asked Jun 15 '14 at 3:03









Charlie ParkerCharlie Parker

2521312




2521312












  • you want to stop using zsh? or oh-my-zsh? which?

    – strugee
    Jun 15 '14 at 3:12











  • either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

    – Charlie Parker
    Jun 15 '14 at 3:21

















  • you want to stop using zsh? or oh-my-zsh? which?

    – strugee
    Jun 15 '14 at 3:12











  • either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

    – Charlie Parker
    Jun 15 '14 at 3:21
















you want to stop using zsh? or oh-my-zsh? which?

– strugee
Jun 15 '14 at 3:12





you want to stop using zsh? or oh-my-zsh? which?

– strugee
Jun 15 '14 at 3:12













either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

– Charlie Parker
Jun 15 '14 at 3:21





either and both. i.e. I want to be able to control both, when I am using zsh and oh-my-zsh

– Charlie Parker
Jun 15 '14 at 3:21










5 Answers
5






active

oldest

votes


















14














The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both.



Disabling zsh



Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.



You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.



Disabling only oh-my-zsh



  1. Check if ~/.zshrc.pre-oh-my-zsh exists. It probably does. (This file will have been created when the oh-my-zsh installation script moved your previous .zshrc out of the way. .zshrc is a startup file of zsh, similar to .bashrc for bash.)

  2. If it does, do mv ~/.zshrc ~/.zshrc.oh-my-zsh. This will put the oh-my-zsh-created .zshrc out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc.

  3. If it does not exist, open ~/.zshrc in a text editor. Find the line that says source $ZSH/.oh-my-zsh and either comment it out or remove it. This will disable the initialization of oh-my-zsh.

You will need to restart your shell for changes to take effect.






share|improve this answer

























  • I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

    – Charlie Parker
    Jun 15 '14 at 3:29











  • @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

    – strugee
    Jun 15 '14 at 3:31






  • 1





    @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

    – strugee
    Jun 16 '14 at 0:03


















4














ZSH Config Switching



If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching.



Put your framework configurations in their own folders. For each framework.



  • Install the framework in its own folder if possible, otherwise

  • If the framework forces installation to ~/.zsh, then
    • Protect the current ~/.zsh first. Either
      • remove the ~/.zsh symlink; rm ~/.zsh, or

      • move the ~/.zsh folder; mv ~/.zsh ~/.zsh.backup


    • Run the framework installer.

    • Move the framework folder to its own directory. e.g. mv ~/.zsh ~/.oh-my-zsh.


  • Repeat for each framework.

Once done, create a shell script for each framework to create the necessary symlinks. Here's an example for zprezto, since I already use it.



$ mkdir ~/bin
$ cat <<EOF > ~/bin/use-zprezto
#!/bin/bash
SYMLINKS=".zsh .zshrc .zshlogin .zshlogout .zshprofile .zpreztorc .zshenv .zshrc"
CONFIG_HOME="$HOME/.zprezto"

# check for unexpected error conditions
for sym in $SYMLINKS; do
# report an error and quit if $sym exists and is not a symlink
[[ -e "$HOME/$sym" -a ! -h "$HOME/$sym" ]] && echo "error: '$HOME/$sym' is not a symlink!"; return 1;
done

# now create the symlinks now that nothing should go wrong
for sym in $SYMLINKS; do
# remove old symlink if it exists
[[ -h "$HOME/$sym" ]] && rm -f "$HOME/$sym"
# create new symlink
ln -s "$CONFIG_HOME/$sym" "$HOME/$sym"
done

# uncomment next line to start a new zsh shell. CAUTION: each call is a zsh shell inside a zsh shell. Too many calls will put you in limbo :D
#/usr/bin/env zsh
EOF

$ chmod 700 ~/bin/use-zprezto


This script is fairly simple and relies on the fact that all my symlinks are organized with the same pattern. You can copy&paste the remove and create lines after the loop for symlinks you have that don't follow the pattern.



Once done, use ~/bin/use-zprezto--or ~/bin/use-whatever--to switch between zsh frameworks.



Note that changes only take effect in new zsh shells, not existing shells.



Shell Switching



It's a bit dangerous, but if you're so inclined, you can use a symlink for your shell command and set the symlink as your default shell. You can then follow the use-* script method above to change your default shell.



As an example with zsh...



$ mkdir ~/bin
$ cat <<EOF > ~/bin/use-zsh
#!/bin/bash
# check for valid shell symlink
if [[ ! -h "$HOME/.shell" ]]; then
echo "error: $HOME/.shell is not a symlink!"
return 1
fi

# remove existing shell symlink if it exists
[[ -h "$HOME/.shell" ]] && rm -f "$HOME/.shell"

# create new shell symlink, but warn user if this fails!
if ! ln -s /usr/bin/zsh "$HOME/.shell"; then
echo "ERROR: failed to create $HOME/.shell symlink. Manually create the symlink or future logins will fail!."
return 2
fi
EOF

$ chmod 700 ~/bin/use-zsh


The reason this is dangerous is that you cannot login under a user if the shell stored in /etc/passwd is not a valid program. So you can lock yourself out of your account if you're not careful; i.e. your ~/.shell symlink is broke or doesn't point to an interactive program. You're welcome to try this with a user account, but this is NOT RECOMMENDED for your root account.



If you still want to continue, then



$ ~/bin/use-zsh # ensures ~/.shell exists for chsh
$ echo "$HOME/.shell | sudo tee -a /etc/shells # add symlink to system's list of valid shells
$ chsh -s ~/.shell # changes default shell in /etc/passwd for $USER





share|improve this answer
































    3














    chsh -s /bin/bash



    To manually set a new default shell, do chsh -s /my/
    new/shell, eg chsh -s /bin/bash. Then simply reopen your shells.






    share|improve this answer






























      2














      You can tell zsh to load its per-user configuration files from a different directory by setting the environment variable ZDOTDIR before starting zsh.



      If you want to start zsh without loading your configuration files, set ZDOTDIR to a non-existent directory. If you want to skip system configuration files (apart from /etc/zshenv), you can run zsh -f. If you want to skip system configuration files but run the per-user files, run zsh -d.



      For example, if you want to test-drive oh-my-zsh without making it the default, don't put the .zshrc from oh-my-zsh in your home directory. Instead, put it somewhere else, eg. in ~/.oh-my-zsh, and then run ZDOTDIR=~/.oh-my-zsh zsh when you want to use oh-my-zsh.




      Terminal applications run the shell indicated by the SHELL environment variable. If this variable is unset, they run the login shell indicated in the user database (/etc/passwd). You can request a different application when you start a terminal emulator, e.g. xterm -e fish.






      share|improve this answer






























        0














        As it's a bit hidden in @Gilles answer the quick way to load zsh without any config e.g. .zshrc .zshenv etc



        zsh -f


        This is useful when you want to test if anything in your config is preventing some feature of zsh from working.






        share|improve this answer























          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f137183%2fhow-do-you-disable-oh-my-zsh-and-zsh-without-uninstalling-it%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          14














          The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both.



          Disabling zsh



          Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.



          You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.



          Disabling only oh-my-zsh



          1. Check if ~/.zshrc.pre-oh-my-zsh exists. It probably does. (This file will have been created when the oh-my-zsh installation script moved your previous .zshrc out of the way. .zshrc is a startup file of zsh, similar to .bashrc for bash.)

          2. If it does, do mv ~/.zshrc ~/.zshrc.oh-my-zsh. This will put the oh-my-zsh-created .zshrc out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc.

          3. If it does not exist, open ~/.zshrc in a text editor. Find the line that says source $ZSH/.oh-my-zsh and either comment it out or remove it. This will disable the initialization of oh-my-zsh.

          You will need to restart your shell for changes to take effect.






          share|improve this answer

























          • I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

            – Charlie Parker
            Jun 15 '14 at 3:29











          • @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

            – strugee
            Jun 15 '14 at 3:31






          • 1





            @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

            – strugee
            Jun 16 '14 at 0:03















          14














          The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both.



          Disabling zsh



          Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.



          You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.



          Disabling only oh-my-zsh



          1. Check if ~/.zshrc.pre-oh-my-zsh exists. It probably does. (This file will have been created when the oh-my-zsh installation script moved your previous .zshrc out of the way. .zshrc is a startup file of zsh, similar to .bashrc for bash.)

          2. If it does, do mv ~/.zshrc ~/.zshrc.oh-my-zsh. This will put the oh-my-zsh-created .zshrc out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc.

          3. If it does not exist, open ~/.zshrc in a text editor. Find the line that says source $ZSH/.oh-my-zsh and either comment it out or remove it. This will disable the initialization of oh-my-zsh.

          You will need to restart your shell for changes to take effect.






          share|improve this answer

























          • I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

            – Charlie Parker
            Jun 15 '14 at 3:29











          • @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

            – strugee
            Jun 15 '14 at 3:31






          • 1





            @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

            – strugee
            Jun 16 '14 at 0:03













          14












          14








          14







          The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both.



          Disabling zsh



          Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.



          You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.



          Disabling only oh-my-zsh



          1. Check if ~/.zshrc.pre-oh-my-zsh exists. It probably does. (This file will have been created when the oh-my-zsh installation script moved your previous .zshrc out of the way. .zshrc is a startup file of zsh, similar to .bashrc for bash.)

          2. If it does, do mv ~/.zshrc ~/.zshrc.oh-my-zsh. This will put the oh-my-zsh-created .zshrc out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc.

          3. If it does not exist, open ~/.zshrc in a text editor. Find the line that says source $ZSH/.oh-my-zsh and either comment it out or remove it. This will disable the initialization of oh-my-zsh.

          You will need to restart your shell for changes to take effect.






          share|improve this answer















          The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh or you want to stop using oh-my-zsh. I will cover both.



          Disabling zsh



          Simply run chsh and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.



          You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.



          Disabling only oh-my-zsh



          1. Check if ~/.zshrc.pre-oh-my-zsh exists. It probably does. (This file will have been created when the oh-my-zsh installation script moved your previous .zshrc out of the way. .zshrc is a startup file of zsh, similar to .bashrc for bash.)

          2. If it does, do mv ~/.zshrc ~/.zshrc.oh-my-zsh. This will put the oh-my-zsh-created .zshrc out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc.

          3. If it does not exist, open ~/.zshrc in a text editor. Find the line that says source $ZSH/.oh-my-zsh and either comment it out or remove it. This will disable the initialization of oh-my-zsh.

          You will need to restart your shell for changes to take effect.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 15 '14 at 3:48

























          answered Jun 15 '14 at 3:26









          strugeestrugee

          8,3441256103




          8,3441256103












          • I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

            – Charlie Parker
            Jun 15 '14 at 3:29











          • @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

            – strugee
            Jun 15 '14 at 3:31






          • 1





            @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

            – strugee
            Jun 16 '14 at 0:03

















          • I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

            – Charlie Parker
            Jun 15 '14 at 3:29











          • @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

            – strugee
            Jun 15 '14 at 3:31






          • 1





            @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

            – strugee
            Jun 16 '14 at 0:03
















          I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

          – Charlie Parker
          Jun 15 '14 at 3:29





          I apologize about my wording. I believe I clarified it. Is it clear now? Thanks btw.

          – Charlie Parker
          Jun 15 '14 at 3:29













          @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

          – strugee
          Jun 15 '14 at 3:31





          @CharlieParker yeah, I was being lazy. I'll expand the answer, maybe explain a bit of the "why".

          – strugee
          Jun 15 '14 at 3:31




          1




          1





          @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

          – strugee
          Jun 16 '14 at 0:03





          @CharlieParker in case you didn't notice, I updated this answer. let me know if anything can be improved.

          – strugee
          Jun 16 '14 at 0:03













          4














          ZSH Config Switching



          If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching.



          Put your framework configurations in their own folders. For each framework.



          • Install the framework in its own folder if possible, otherwise

          • If the framework forces installation to ~/.zsh, then
            • Protect the current ~/.zsh first. Either
              • remove the ~/.zsh symlink; rm ~/.zsh, or

              • move the ~/.zsh folder; mv ~/.zsh ~/.zsh.backup


            • Run the framework installer.

            • Move the framework folder to its own directory. e.g. mv ~/.zsh ~/.oh-my-zsh.


          • Repeat for each framework.

          Once done, create a shell script for each framework to create the necessary symlinks. Here's an example for zprezto, since I already use it.



          $ mkdir ~/bin
          $ cat <<EOF > ~/bin/use-zprezto
          #!/bin/bash
          SYMLINKS=".zsh .zshrc .zshlogin .zshlogout .zshprofile .zpreztorc .zshenv .zshrc"
          CONFIG_HOME="$HOME/.zprezto"

          # check for unexpected error conditions
          for sym in $SYMLINKS; do
          # report an error and quit if $sym exists and is not a symlink
          [[ -e "$HOME/$sym" -a ! -h "$HOME/$sym" ]] && echo "error: '$HOME/$sym' is not a symlink!"; return 1;
          done

          # now create the symlinks now that nothing should go wrong
          for sym in $SYMLINKS; do
          # remove old symlink if it exists
          [[ -h "$HOME/$sym" ]] && rm -f "$HOME/$sym"
          # create new symlink
          ln -s "$CONFIG_HOME/$sym" "$HOME/$sym"
          done

          # uncomment next line to start a new zsh shell. CAUTION: each call is a zsh shell inside a zsh shell. Too many calls will put you in limbo :D
          #/usr/bin/env zsh
          EOF

          $ chmod 700 ~/bin/use-zprezto


          This script is fairly simple and relies on the fact that all my symlinks are organized with the same pattern. You can copy&paste the remove and create lines after the loop for symlinks you have that don't follow the pattern.



          Once done, use ~/bin/use-zprezto--or ~/bin/use-whatever--to switch between zsh frameworks.



          Note that changes only take effect in new zsh shells, not existing shells.



          Shell Switching



          It's a bit dangerous, but if you're so inclined, you can use a symlink for your shell command and set the symlink as your default shell. You can then follow the use-* script method above to change your default shell.



          As an example with zsh...



          $ mkdir ~/bin
          $ cat <<EOF > ~/bin/use-zsh
          #!/bin/bash
          # check for valid shell symlink
          if [[ ! -h "$HOME/.shell" ]]; then
          echo "error: $HOME/.shell is not a symlink!"
          return 1
          fi

          # remove existing shell symlink if it exists
          [[ -h "$HOME/.shell" ]] && rm -f "$HOME/.shell"

          # create new shell symlink, but warn user if this fails!
          if ! ln -s /usr/bin/zsh "$HOME/.shell"; then
          echo "ERROR: failed to create $HOME/.shell symlink. Manually create the symlink or future logins will fail!."
          return 2
          fi
          EOF

          $ chmod 700 ~/bin/use-zsh


          The reason this is dangerous is that you cannot login under a user if the shell stored in /etc/passwd is not a valid program. So you can lock yourself out of your account if you're not careful; i.e. your ~/.shell symlink is broke or doesn't point to an interactive program. You're welcome to try this with a user account, but this is NOT RECOMMENDED for your root account.



          If you still want to continue, then



          $ ~/bin/use-zsh # ensures ~/.shell exists for chsh
          $ echo "$HOME/.shell | sudo tee -a /etc/shells # add symlink to system's list of valid shells
          $ chsh -s ~/.shell # changes default shell in /etc/passwd for $USER





          share|improve this answer





























            4














            ZSH Config Switching



            If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching.



            Put your framework configurations in their own folders. For each framework.



            • Install the framework in its own folder if possible, otherwise

            • If the framework forces installation to ~/.zsh, then
              • Protect the current ~/.zsh first. Either
                • remove the ~/.zsh symlink; rm ~/.zsh, or

                • move the ~/.zsh folder; mv ~/.zsh ~/.zsh.backup


              • Run the framework installer.

              • Move the framework folder to its own directory. e.g. mv ~/.zsh ~/.oh-my-zsh.


            • Repeat for each framework.

            Once done, create a shell script for each framework to create the necessary symlinks. Here's an example for zprezto, since I already use it.



            $ mkdir ~/bin
            $ cat <<EOF > ~/bin/use-zprezto
            #!/bin/bash
            SYMLINKS=".zsh .zshrc .zshlogin .zshlogout .zshprofile .zpreztorc .zshenv .zshrc"
            CONFIG_HOME="$HOME/.zprezto"

            # check for unexpected error conditions
            for sym in $SYMLINKS; do
            # report an error and quit if $sym exists and is not a symlink
            [[ -e "$HOME/$sym" -a ! -h "$HOME/$sym" ]] && echo "error: '$HOME/$sym' is not a symlink!"; return 1;
            done

            # now create the symlinks now that nothing should go wrong
            for sym in $SYMLINKS; do
            # remove old symlink if it exists
            [[ -h "$HOME/$sym" ]] && rm -f "$HOME/$sym"
            # create new symlink
            ln -s "$CONFIG_HOME/$sym" "$HOME/$sym"
            done

            # uncomment next line to start a new zsh shell. CAUTION: each call is a zsh shell inside a zsh shell. Too many calls will put you in limbo :D
            #/usr/bin/env zsh
            EOF

            $ chmod 700 ~/bin/use-zprezto


            This script is fairly simple and relies on the fact that all my symlinks are organized with the same pattern. You can copy&paste the remove and create lines after the loop for symlinks you have that don't follow the pattern.



            Once done, use ~/bin/use-zprezto--or ~/bin/use-whatever--to switch between zsh frameworks.



            Note that changes only take effect in new zsh shells, not existing shells.



            Shell Switching



            It's a bit dangerous, but if you're so inclined, you can use a symlink for your shell command and set the symlink as your default shell. You can then follow the use-* script method above to change your default shell.



            As an example with zsh...



            $ mkdir ~/bin
            $ cat <<EOF > ~/bin/use-zsh
            #!/bin/bash
            # check for valid shell symlink
            if [[ ! -h "$HOME/.shell" ]]; then
            echo "error: $HOME/.shell is not a symlink!"
            return 1
            fi

            # remove existing shell symlink if it exists
            [[ -h "$HOME/.shell" ]] && rm -f "$HOME/.shell"

            # create new shell symlink, but warn user if this fails!
            if ! ln -s /usr/bin/zsh "$HOME/.shell"; then
            echo "ERROR: failed to create $HOME/.shell symlink. Manually create the symlink or future logins will fail!."
            return 2
            fi
            EOF

            $ chmod 700 ~/bin/use-zsh


            The reason this is dangerous is that you cannot login under a user if the shell stored in /etc/passwd is not a valid program. So you can lock yourself out of your account if you're not careful; i.e. your ~/.shell symlink is broke or doesn't point to an interactive program. You're welcome to try this with a user account, but this is NOT RECOMMENDED for your root account.



            If you still want to continue, then



            $ ~/bin/use-zsh # ensures ~/.shell exists for chsh
            $ echo "$HOME/.shell | sudo tee -a /etc/shells # add symlink to system's list of valid shells
            $ chsh -s ~/.shell # changes default shell in /etc/passwd for $USER





            share|improve this answer



























              4












              4








              4







              ZSH Config Switching



              If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching.



              Put your framework configurations in their own folders. For each framework.



              • Install the framework in its own folder if possible, otherwise

              • If the framework forces installation to ~/.zsh, then
                • Protect the current ~/.zsh first. Either
                  • remove the ~/.zsh symlink; rm ~/.zsh, or

                  • move the ~/.zsh folder; mv ~/.zsh ~/.zsh.backup


                • Run the framework installer.

                • Move the framework folder to its own directory. e.g. mv ~/.zsh ~/.oh-my-zsh.


              • Repeat for each framework.

              Once done, create a shell script for each framework to create the necessary symlinks. Here's an example for zprezto, since I already use it.



              $ mkdir ~/bin
              $ cat <<EOF > ~/bin/use-zprezto
              #!/bin/bash
              SYMLINKS=".zsh .zshrc .zshlogin .zshlogout .zshprofile .zpreztorc .zshenv .zshrc"
              CONFIG_HOME="$HOME/.zprezto"

              # check for unexpected error conditions
              for sym in $SYMLINKS; do
              # report an error and quit if $sym exists and is not a symlink
              [[ -e "$HOME/$sym" -a ! -h "$HOME/$sym" ]] && echo "error: '$HOME/$sym' is not a symlink!"; return 1;
              done

              # now create the symlinks now that nothing should go wrong
              for sym in $SYMLINKS; do
              # remove old symlink if it exists
              [[ -h "$HOME/$sym" ]] && rm -f "$HOME/$sym"
              # create new symlink
              ln -s "$CONFIG_HOME/$sym" "$HOME/$sym"
              done

              # uncomment next line to start a new zsh shell. CAUTION: each call is a zsh shell inside a zsh shell. Too many calls will put you in limbo :D
              #/usr/bin/env zsh
              EOF

              $ chmod 700 ~/bin/use-zprezto


              This script is fairly simple and relies on the fact that all my symlinks are organized with the same pattern. You can copy&paste the remove and create lines after the loop for symlinks you have that don't follow the pattern.



              Once done, use ~/bin/use-zprezto--or ~/bin/use-whatever--to switch between zsh frameworks.



              Note that changes only take effect in new zsh shells, not existing shells.



              Shell Switching



              It's a bit dangerous, but if you're so inclined, you can use a symlink for your shell command and set the symlink as your default shell. You can then follow the use-* script method above to change your default shell.



              As an example with zsh...



              $ mkdir ~/bin
              $ cat <<EOF > ~/bin/use-zsh
              #!/bin/bash
              # check for valid shell symlink
              if [[ ! -h "$HOME/.shell" ]]; then
              echo "error: $HOME/.shell is not a symlink!"
              return 1
              fi

              # remove existing shell symlink if it exists
              [[ -h "$HOME/.shell" ]] && rm -f "$HOME/.shell"

              # create new shell symlink, but warn user if this fails!
              if ! ln -s /usr/bin/zsh "$HOME/.shell"; then
              echo "ERROR: failed to create $HOME/.shell symlink. Manually create the symlink or future logins will fail!."
              return 2
              fi
              EOF

              $ chmod 700 ~/bin/use-zsh


              The reason this is dangerous is that you cannot login under a user if the shell stored in /etc/passwd is not a valid program. So you can lock yourself out of your account if you're not careful; i.e. your ~/.shell symlink is broke or doesn't point to an interactive program. You're welcome to try this with a user account, but this is NOT RECOMMENDED for your root account.



              If you still want to continue, then



              $ ~/bin/use-zsh # ensures ~/.shell exists for chsh
              $ echo "$HOME/.shell | sudo tee -a /etc/shells # add symlink to system's list of valid shells
              $ chsh -s ~/.shell # changes default shell in /etc/passwd for $USER





              share|improve this answer















              ZSH Config Switching



              If you want to test different zsh configuration frameworks (oh-my-zsh, zprezto, etc) and switch between them, your best bet is using symbolic links for ~/.zsh, ~/.zshrc, ~/.zlogin, ~/.zlogout, ~/.zprofile, and ~/.zshenv. You may want to create a shell scripts for each framework to create those symlinks for faster switching.



              Put your framework configurations in their own folders. For each framework.



              • Install the framework in its own folder if possible, otherwise

              • If the framework forces installation to ~/.zsh, then
                • Protect the current ~/.zsh first. Either
                  • remove the ~/.zsh symlink; rm ~/.zsh, or

                  • move the ~/.zsh folder; mv ~/.zsh ~/.zsh.backup


                • Run the framework installer.

                • Move the framework folder to its own directory. e.g. mv ~/.zsh ~/.oh-my-zsh.


              • Repeat for each framework.

              Once done, create a shell script for each framework to create the necessary symlinks. Here's an example for zprezto, since I already use it.



              $ mkdir ~/bin
              $ cat <<EOF > ~/bin/use-zprezto
              #!/bin/bash
              SYMLINKS=".zsh .zshrc .zshlogin .zshlogout .zshprofile .zpreztorc .zshenv .zshrc"
              CONFIG_HOME="$HOME/.zprezto"

              # check for unexpected error conditions
              for sym in $SYMLINKS; do
              # report an error and quit if $sym exists and is not a symlink
              [[ -e "$HOME/$sym" -a ! -h "$HOME/$sym" ]] && echo "error: '$HOME/$sym' is not a symlink!"; return 1;
              done

              # now create the symlinks now that nothing should go wrong
              for sym in $SYMLINKS; do
              # remove old symlink if it exists
              [[ -h "$HOME/$sym" ]] && rm -f "$HOME/$sym"
              # create new symlink
              ln -s "$CONFIG_HOME/$sym" "$HOME/$sym"
              done

              # uncomment next line to start a new zsh shell. CAUTION: each call is a zsh shell inside a zsh shell. Too many calls will put you in limbo :D
              #/usr/bin/env zsh
              EOF

              $ chmod 700 ~/bin/use-zprezto


              This script is fairly simple and relies on the fact that all my symlinks are organized with the same pattern. You can copy&paste the remove and create lines after the loop for symlinks you have that don't follow the pattern.



              Once done, use ~/bin/use-zprezto--or ~/bin/use-whatever--to switch between zsh frameworks.



              Note that changes only take effect in new zsh shells, not existing shells.



              Shell Switching



              It's a bit dangerous, but if you're so inclined, you can use a symlink for your shell command and set the symlink as your default shell. You can then follow the use-* script method above to change your default shell.



              As an example with zsh...



              $ mkdir ~/bin
              $ cat <<EOF > ~/bin/use-zsh
              #!/bin/bash
              # check for valid shell symlink
              if [[ ! -h "$HOME/.shell" ]]; then
              echo "error: $HOME/.shell is not a symlink!"
              return 1
              fi

              # remove existing shell symlink if it exists
              [[ -h "$HOME/.shell" ]] && rm -f "$HOME/.shell"

              # create new shell symlink, but warn user if this fails!
              if ! ln -s /usr/bin/zsh "$HOME/.shell"; then
              echo "ERROR: failed to create $HOME/.shell symlink. Manually create the symlink or future logins will fail!."
              return 2
              fi
              EOF

              $ chmod 700 ~/bin/use-zsh


              The reason this is dangerous is that you cannot login under a user if the shell stored in /etc/passwd is not a valid program. So you can lock yourself out of your account if you're not careful; i.e. your ~/.shell symlink is broke or doesn't point to an interactive program. You're welcome to try this with a user account, but this is NOT RECOMMENDED for your root account.



              If you still want to continue, then



              $ ~/bin/use-zsh # ensures ~/.shell exists for chsh
              $ echo "$HOME/.shell | sudo tee -a /etc/shells # add symlink to system's list of valid shells
              $ chsh -s ~/.shell # changes default shell in /etc/passwd for $USER






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jun 15 '14 at 5:45

























              answered Jun 15 '14 at 5:11









              Justin CJustin C

              49539




              49539





















                  3














                  chsh -s /bin/bash



                  To manually set a new default shell, do chsh -s /my/
                  new/shell, eg chsh -s /bin/bash. Then simply reopen your shells.






                  share|improve this answer



























                    3














                    chsh -s /bin/bash



                    To manually set a new default shell, do chsh -s /my/
                    new/shell, eg chsh -s /bin/bash. Then simply reopen your shells.






                    share|improve this answer

























                      3












                      3








                      3







                      chsh -s /bin/bash



                      To manually set a new default shell, do chsh -s /my/
                      new/shell, eg chsh -s /bin/bash. Then simply reopen your shells.






                      share|improve this answer













                      chsh -s /bin/bash



                      To manually set a new default shell, do chsh -s /my/
                      new/shell, eg chsh -s /bin/bash. Then simply reopen your shells.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 4 '17 at 9:11









                      Honghui LiHonghui Li

                      311




                      311





















                          2














                          You can tell zsh to load its per-user configuration files from a different directory by setting the environment variable ZDOTDIR before starting zsh.



                          If you want to start zsh without loading your configuration files, set ZDOTDIR to a non-existent directory. If you want to skip system configuration files (apart from /etc/zshenv), you can run zsh -f. If you want to skip system configuration files but run the per-user files, run zsh -d.



                          For example, if you want to test-drive oh-my-zsh without making it the default, don't put the .zshrc from oh-my-zsh in your home directory. Instead, put it somewhere else, eg. in ~/.oh-my-zsh, and then run ZDOTDIR=~/.oh-my-zsh zsh when you want to use oh-my-zsh.




                          Terminal applications run the shell indicated by the SHELL environment variable. If this variable is unset, they run the login shell indicated in the user database (/etc/passwd). You can request a different application when you start a terminal emulator, e.g. xterm -e fish.






                          share|improve this answer



























                            2














                            You can tell zsh to load its per-user configuration files from a different directory by setting the environment variable ZDOTDIR before starting zsh.



                            If you want to start zsh without loading your configuration files, set ZDOTDIR to a non-existent directory. If you want to skip system configuration files (apart from /etc/zshenv), you can run zsh -f. If you want to skip system configuration files but run the per-user files, run zsh -d.



                            For example, if you want to test-drive oh-my-zsh without making it the default, don't put the .zshrc from oh-my-zsh in your home directory. Instead, put it somewhere else, eg. in ~/.oh-my-zsh, and then run ZDOTDIR=~/.oh-my-zsh zsh when you want to use oh-my-zsh.




                            Terminal applications run the shell indicated by the SHELL environment variable. If this variable is unset, they run the login shell indicated in the user database (/etc/passwd). You can request a different application when you start a terminal emulator, e.g. xterm -e fish.






                            share|improve this answer

























                              2












                              2








                              2







                              You can tell zsh to load its per-user configuration files from a different directory by setting the environment variable ZDOTDIR before starting zsh.



                              If you want to start zsh without loading your configuration files, set ZDOTDIR to a non-existent directory. If you want to skip system configuration files (apart from /etc/zshenv), you can run zsh -f. If you want to skip system configuration files but run the per-user files, run zsh -d.



                              For example, if you want to test-drive oh-my-zsh without making it the default, don't put the .zshrc from oh-my-zsh in your home directory. Instead, put it somewhere else, eg. in ~/.oh-my-zsh, and then run ZDOTDIR=~/.oh-my-zsh zsh when you want to use oh-my-zsh.




                              Terminal applications run the shell indicated by the SHELL environment variable. If this variable is unset, they run the login shell indicated in the user database (/etc/passwd). You can request a different application when you start a terminal emulator, e.g. xterm -e fish.






                              share|improve this answer













                              You can tell zsh to load its per-user configuration files from a different directory by setting the environment variable ZDOTDIR before starting zsh.



                              If you want to start zsh without loading your configuration files, set ZDOTDIR to a non-existent directory. If you want to skip system configuration files (apart from /etc/zshenv), you can run zsh -f. If you want to skip system configuration files but run the per-user files, run zsh -d.



                              For example, if you want to test-drive oh-my-zsh without making it the default, don't put the .zshrc from oh-my-zsh in your home directory. Instead, put it somewhere else, eg. in ~/.oh-my-zsh, and then run ZDOTDIR=~/.oh-my-zsh zsh when you want to use oh-my-zsh.




                              Terminal applications run the shell indicated by the SHELL environment variable. If this variable is unset, they run the login shell indicated in the user database (/etc/passwd). You can request a different application when you start a terminal emulator, e.g. xterm -e fish.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 16 '14 at 1:49









                              GillesGilles

                              547k13011131630




                              547k13011131630





















                                  0














                                  As it's a bit hidden in @Gilles answer the quick way to load zsh without any config e.g. .zshrc .zshenv etc



                                  zsh -f


                                  This is useful when you want to test if anything in your config is preventing some feature of zsh from working.






                                  share|improve this answer



























                                    0














                                    As it's a bit hidden in @Gilles answer the quick way to load zsh without any config e.g. .zshrc .zshenv etc



                                    zsh -f


                                    This is useful when you want to test if anything in your config is preventing some feature of zsh from working.






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      As it's a bit hidden in @Gilles answer the quick way to load zsh without any config e.g. .zshrc .zshenv etc



                                      zsh -f


                                      This is useful when you want to test if anything in your config is preventing some feature of zsh from working.






                                      share|improve this answer













                                      As it's a bit hidden in @Gilles answer the quick way to load zsh without any config e.g. .zshrc .zshenv etc



                                      zsh -f


                                      This is useful when you want to test if anything in your config is preventing some feature of zsh from working.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 15 at 12:00









                                      zzapperzzapper

                                      719614




                                      719614



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f137183%2fhow-do-you-disable-oh-my-zsh-and-zsh-without-uninstalling-it%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown






                                          Popular posts from this blog

                                          How to check contact read email or not when send email to Individual?

                                          Bahrain

                                          Postfix configuration issue with fips on centos 7; mailgun relay