Just hosed my $PATH variable

I was trying to use ruby gems for the first time, so I had to add the gems to my $PATH variable.  I accidentally set the PATH variable to the new value, rather than appending the new value.

DO THIS:

export PATH = $PATH:new/path

DON’T DO THIS!

export PATH = new/path

I fixed it by logging out, and logging back in again.  Setting or adding to the PATH variable in the terminal only modifieds the variable for the current login session; I think I could have just closed the terminal session instead of logging out.  To modify the PATH variable permanently, modify the ~/.bashrc file to include this line:

export PATH = $PATH:$HOME/new/path/from/home

or

export PATH = $PATH:/new/path/from/root

If you’d like to read more, I got my information from a good ubuntuforums thread.

Advertisements

About ehmatthes

Teacher, hacker, new dad, outdoor guy
This entry was posted in programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s