[LRUG] Deleted the contents of ~/.zshrc and ~/.bashrc, system can'tfind rubygems.

Luke Bennellick bennellick.luke at gmail.com
Fri Mar 10 01:39:47 PST 2017


This is an annoying problem but usually fairly easily remedied! Like jc
said above, it's likely because your rbenv or rvm files are no longer
loaded when you start your shell.

First thing to do is figure out which shell you actually use. Type this
into your terminal:

$0

That'll tell you which shell you use. It'll likely return zsh given that
you had a zshrc file.

>From here just do what jc said, and reinstall rbenv.. (or rvm, whichever
you used); Make sure during the installation (if you're using zsh) that you
change the copy paste install paths from bashrc to zshrc, for example:

Change from:

*echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile*

To

*echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc*

In the install instructions.

This also answers your other question about why you also had a bashrc! I
expect at some point you may have copy paste installed something which
created and appended to your bashrc, but then was never used. I'd be very
surprised if your system was somehow dynamically switching between shells.

If you're using zshrc, also consider reinstalling oh-my-zsh. This will
restore some of your (probably) lost functionality.

It's very useful to keep all of your dot files in an git repo, I have one
dedicated to tmux, zsh, vimrc etc - any changes I make I immediately push.

Hope this helps.

Luke

On 10 March 2017 at 09:26, <jc at panagile.com> wrote:

> “Are most devs not stupid enough to delete these files?”
>
>
>
> I’m pretty sure that most devs I know have done something similar at some
> point, even if it’s not specifically deleting those files.
>
>
>
> Are you using rvm/rbenv? They both have some setup that goes into your
> .bashrc/.zshrc to enable you to pick up the correct version of ruby.
> Without them you’re probably falling back to the version of ruby that comes
> with OSX, which doesn’t have any of your gems installed.
>
>
>
> The version of ruby that you want, along with all of the gems, is still
> there. You just need to get rvm/rbenv working again. Look at the install
> instructions for them, specifically the bits about adding a line to your
> .bashrc/.zshrc.
>
>
>
>
>
> *From: *Jesse Waites <jesse.waites at gmail.com>
> *Sent: *10 March 2017 08:43
> *To: *London Ruby Users Group <chat at lists.lrug.org>
> *Subject: *[LRUG] Deleted the contents of ~/.zshrc and ~/.bashrc, system
> can'tfind rubygems.
>
>
>
> Yesterday, because I'm an idiot, I deleted the content of my ~/.zshrc and
> ~/.bashrc files. Now, I can't start my rails server, console, anything - it
> says it cant find my gems. Can someone PLEASE answer a few questions. I
> have been struggling with this for over 12 hours and unable to do the work
> at my job since my system is down. I have tried putting the paths from 'gem
> environment' into bashrc
>
> "export GEM_PATH=/Library/Ruby/Gems/1.8/:${GEM_PATH}"
>
> but it doesn't work.
>
>
> 1) Why do I even have both ZSH and Bash? Did homebrew install one?
>
>
>
> 2) Why did my terminal (iTerm) seem to switch between zsh and bash
> depending on what program I'm running?
>
>
>
> 3) Should I delete bash or zsh and focus on fixing the path to my gems?
>
>
>
> 4) How do I FIND the path to my gems? I have tried 'gem environment' and
> pasting the output from there (4 lines? 4 environments?) but it doesnt seem
> to work. I just want my system to work how it did 2 days ago :(
>
>
>
> 5) How could this have happened to me? Are most devs not stupid enough to
> delete these files? Im shocked this simple thing has had such devastating
> consequences. This must be why devs back up their dotfiles on github?
>
>
>
> 6) Should I focus on installing rails, gems, etc where it IS looking? I
> keep getting 'cant build for this or that reason' so thats a nonstarter as
> well.
>
>
>
> 7) Can someone email me a gist of their ~/.zshrc and ~/.bashrc or
> ~/.bash_profile?
>
>
>
> 8) Is there a "stock" one I can use? I can't find an unmodified one on
> github.
>
>
>
> This whole situation is like, every thread I pull on, something else falls
> apart. I cannot believe it. Complete disaster. Please help me or kill me
> and put me out of my misery. I am pulling my hair out here.
>
>
>
> --
>
> Jesse Waites
>
> Web Developer
>
> JesseWaites.com
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20170310/f8a893d3/attachment.html>


More information about the Chat mailing list