What To Do When You Can’t Upgrade Oh my zsh

I have been using the Z Shell, specifically Oh My Zsh, for almost two years now. It worked without a hitch for a while, and then one day it didn’t work so smoothly. It had something to do with my PATH configuration. I’m not sure whether the issue began before or after I installed El Capitan (but I don’t think so), or if it was a ruby gems installation issue. I think it was the latter. Anyway, it never seemed to resolve itself.

I started to dive deeper into Command Line. I was getting to know my computer much better. One of my New Year’s Resolutions is to become extremely well acquainted with the Command Line, and therefore my computer. I know that this will make me a MUCH better developer, designer, and technologist in general. It will also help me with another of my New Year’s resolutions. Increasing my knowledge of personal cyber security. Everyone these days should educate themselves about personal cyber security. It’s a crazy world out there in the realm of technology!

But my Z shell education sky rocketed when I came across Wes Bos’ video series entitled “Command Line For Power Users”. In it he goes into depth about how to set up the Z Shell on your computer, and specifically Oh my zsh. There is not much great documentation on the topic all in one place geared at developers. Many even frown upon replacing the default bash. I disagree. I think it’s great. I will be very soon learning more about exactly why. I’m only a bit more than halfway through the course.

But I digress. I re-encountered my $PATH problem with oh-my-zsh when playing around with the different oh-my-zsh themes I have installed on my computer. Everything was fine until I added the Soliah theme. It told me that my rvm (Ruby Version Manager) $PATH was configured incorrectly and that I should fix it. This is the message I would get in Terminal (now iTerm2):

[[-s"$HOME/.rvm/scripts/rvm"]]&&source"$HOME/.rvm/scripts/rvm"# Load RVM into a shell session *as a function*

I found the same fix elsewhere, but the explanations were not as clear. My .bashrc already contained the line mentioned above, but my .bash_profile contained PATH instead of HOME. I think something happened during installation of my ruby gems. I installed that when I was taking a Web Development Course, and already had installed Z shell/Oh my zsh. I clearly remember the teacher telling me that I should be using the default bash shell, and I said “No. I want to use Oh my zsh.” Then he created a hack so that I would be able to use both (nightmare), and a whole bunch of other stuff which he didn’t even clue me in on. That’s why I will say it again (and again and again and again if I have to): so important to know Command Line, and thus get to know the inner workings of your computer, so that you don’t have to be at the mercy of others who then won’t even enlighten you as to what they have done to your machine! And their fix won’t necessarily be the right one for you OR your machine! It’s like a doctor not knowing his or her anatomy!

To read the entire article on resolving your RVM $PATH, please visit RVM Warning PATH is not properly set up – SOLVED by Tom Ordonez. It’s very short, contains a link to the Michael Papis (RVM tech lead) thread on Github regarding the issue, and is definitely worth your time.

The issue wasn’t resolved immediately, however. Why? First of all, I didn’t completely quit iTerm2. I only closed the window. In order for iTerm2 to register the change, you have to quit the program and re-open it. OR, you should type the command source + path to file that was changed. For instance, if I changed the oh-my-zsh theme I was using in iTerm2 in my .zshrc file, I would save the file, go back into iTerm2 and type the command

Shell

1

source~/.zshrc

and hit return. I would immediately notice in the current instance of iTerm2 that my theme had changed. In the case of my .bash_profile, I typed

Shell

1

source~/.bash_profile

to update it. OR completely quit Terminal and re-open it.

After I had gotten half-way into Wes’ course, I became much more familiar with the Z shell, and realized that I hadn’t completely quit Terminal or updated my .bash_profile with the source command. So I did it, and this is what I subsequently got in terminal when I checked for my version of ruby AND RVM:

My problems weren’t quite over yet, however. I still had the issue of not being able to upgrade my oh-my-zsh. That started happening after I installed El Capitan. Something happened to the path to my oh-my-zsh local repository on my computer when I upgraded to El Capitan. I would try and fix the issue as explained on StackOverFlow and elsewhere, but it never took. This is what would appear in Terminal when I would try and upgradeoh-my-zsh:

PHP

1

2

3

Upgrading Oh My Zsh

fatal:Notagit repository(orany of the parentdirectories):.git

There was an error updating.Tryagain later?

And when I would try and initialize it as a new (local) git repository, I would get the message:

PHP

1

2

3

4

5

6

fatal:'origin'does notappear tobeagit repository

fatal:Could notread from remote repository.

Please make sure you have the correct access rights

andthe repository exists.

Well, yesterday I tried again after fixing the $PATH issue. And this time it took! This is what I did:

Shell

1

2

git init

git remote add origingit@github.com:robbyrussell/oh-my-zsh.git

The second line contains the SSH for oh-my-zsh, because that’s how I’m set up with Github. I use public and private SSH keys to identify myself, or rather my computer, with Github. If you are not set up that way, please switch over. It’s much more secure that way, and much less of a hassle in the long run! To learn about Github and SSH, please visit Github’s documentation Adding a new SSH key to your GitHub account.

And my initialization took! So I had to complete the process with:

PHP

1

2

git fetch

git reset--hard origin/master

git fetch fetches the latest version of the oh-my-zsh repository on Github, and git reset --hard origin/master means

1

throwaway all my staged andun-staged changes,forget everything on my current local branch andmake it exactly the same asorigin/master

Like this:

Related

Maria Campbell

Founder, Inter-Global Media Network, Inc., where I focus on Front End Development. as well as a digital photographer, videographer, blogger, broadcaster, and graphic designer. Genesis Framework user. I got my start 8+ years ago teaching myself HTML/CSS and Wordpress Development because I couldn't find anyone who could create what I wanted. I have been working with open source software ever since. I am an open source software evangelist, and a "Women in Technology" evangelist. A creative professional myself, I find Web Development to be both practical and creative. I love to cook, travel, read mysteries, love everything French, the beach at sunrise, my three cats, and hope to revisit the city of San Francisco one day.

Reader Interactions

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. Comments are moderated, so spammy or malicious links will be removed.