Oh-My-ZHS, RVM and $PATH
When I was learning Mirth Connect I ran into some strange port problem: there was not much explanation from the command_line apart from that “port was taken”. Well, I started butchering RVM and realized that it was complaining about some mysterious things, that I have never even seen before. While running `$rvm get stable` to see if I was using the `stable` version, my logs were bright red with WARNINGS and ERRORS.
`WARNING: Above files contains `PATH=` with no `$PATH` inside, this can break RVM`
It took a lot of digging around to at least find what it was all about.
I got a lot of ideas from Wynwood Tech slack channel guys and GitHub discussions, but in the end it all comes down to your specific case and how much stuff you are willing to break. A few weeks ago I would have definitely felt terrified to even come close to some hidden files on my machine, but today, I felt like it was a simple choice: I either try and dive in, or I get stuck and do nothing further. I chose the first.
————————————————————————–
What I’ve learned is that you can open any hidden files (as long as you know their little secret names, lol) through your command_line, by running:
`$vim ~/.name_of_the_file`
I am not a big fan of retro-looking vim world, so I used `atom` instead, by just substituting `vim`.
The files that everyone recommended changing were: `.bash_profile` and `.profile`.
These two, as their names read, take care of your command_line (AKA ‘bash’) profile every time you log-in. (Recommend reading more about them here. ) So, when you miss a PATH you first check those guys and add these lines of code:
.bash_profile
`export PATH=~/opt/bin:$PATH`
.profile
`export PATH="$PATH:$HOME/.rvm/bin"` # Add RVM to PATH for scripting
and then reload the files:
$source ~/.bash_profile && source ~/.profile
This should have fixed the problem…
Unless, in my particular case, it did’t.
————————————————————————–
When you have tried everything and asked everybody, you feel like the only way now is to gut the whole thing, reinstall or even switch to another environment. So that was my next step: try to, maybe, change the settings of ZHS and get away with it, because I had a suspicion, it all started happening after the latest update.
I started looking for new themes and reinstall options. And that’s when I had an idea… I couldn’t quite understand what kind of files the ERROR was throwing in the warning. They could not be found anywhere… SO maybe they were HIDDEN!? And didn’t I just learn how to open the hidden files?? I went for it. Atom kindly opened the faulty file:
`$atom ~/.zshrc`
And here it was, just like the confusing error-log was saying, on line 56 some unfinished:
`export PATH="`
As soon as I commented it out, things started looking better, after reloading with `source` and running `rvm get stable` for a 100-th time. Alas, it was not the end of it. Now, I was bluntly staring at this:
`Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set`
Common! Really?
But the end was near. I just went for adding `$GEM` in front of `_HOME` in `.bashrc ` and `.zshrc` files, so it looked like this:
export PATH="$PATH:$GEM_HOME/.rvm/bin"
I ran `source` just to be sure for all the files, then `rvm get stable` and watched the wicked RVM reload with only friendly yellow and blue colors!