Delete things from $PATH

path

I fiddled with my $PATH and now it's not working correctly anymore. So I thought, well, just remove the last things I added. However, I can't seem to figure out how.
I added things like so

export MAGICK_HOME="/Library/ImageMagick-6.7.5/"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"

I do not have the files ~/.bash_login or ~/.profile or /etc/environment. I can't find the mentioned strings in /etc/path or /etc/bashrc. I don't know a command except export, that manipulates the $PATH.

How do I get rid of these strings? (And, if it's obvious to you, what did I mess up?)

Best Answer

If you just typed in the exports into the terminal as noted above then the variables in the environment will only last until you exit that terminal session. So simply typing exit and then reopening another terminal will remove any setting that you applied with the noted exports performed in your question.

export MAGICK_HOME="/Library/ImageMagick-6.7.5/"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"

Additionally you can un set variables from the environment by using the unset command.

For example:

unset MAGICK_HOME # will remove MAGICK_HOME from the environment. 

You can do it for the others as well but if you do it for PATH you will lose your path setting until you close this terminal session and reopen a new window,etc.

As an experiment try typing:

env | grep MAGICK_HOME

You should see MAGICK_HOME=/Library/ImageMagick-6.7.5/ echoed back if its still in the environment. If its not then the settings have already been lost by a windows close. etc re-enter your export of MAGICK_HOME and try the above command again.

then

exit

and then finally re open a new terminal window and enter:

env | grep MAGICK_HOME 

Your settings should be gone for MAGICK_HOME. The same is true for the modification done to all the other environment variables set with the export command right in a terminal session. They will just return to their default values if you have not set them in a start-up invocation file as required for your shell environment variables to have a more permanent place in your shell enviorment.