Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Alternative Operating Systems > HELP! I screwed up my PATH!

HELP! I screwed up my PATH!
Thread Tools
MacPC
Forum Regular
Join Date: Aug 2006
Status: Offline
Reply With Quote
Feb 14, 2007, 04:02 AM
 
Hi,

I was following the instruction to install MySQL. I exported mysql into PATH.
MySQL work in the terminal windows but all other commends stoped working, so I did this: export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin
to restore the PATH, it worked when I was still in terminal, I could use ls, cp... commands again. But the problem is that when I quit the terminal then restart it again, In Darwin it says -bash export:`/bin:/usr/bin: /sbin:/usr/sbin':not a valid identifier. When I type ls, I get this error, -bash I command not found.

What's going on there?

By the way, I use a G$ Mac min, OSX 10.4.8.

Thanks in advance

MacPC
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 14, 2007, 04:32 AM
 
If you put the export PATH statement into your .bashrc or .bash_profile file it should work in every new bash session.
     
MacPC  (op)
Forum Regular
Join Date: Aug 2006
Status: Offline
Reply With Quote
Feb 14, 2007, 11:24 AM
 
Thanks.

I actually went into the ~/.bash_profile and edited it with this line:
PATH:/usr/bin:/bin:/xyz...:$PATH. Now everything is back to normal except when I open terminal, under Darwin it still says export: `/usr/bin:/bin:.....':not a valid identifier. How do I get rid of this message?

MacPC
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 14, 2007, 04:08 PM
 
Hmm, I'm not sure.

What happens if you use this line instead:
PATH = $PATH:/bin:/usr/bin/:/sbin:/usr/sbin

And BTW, are you sure those paths all exist on your Mac?
     
itistoday
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Feb 15, 2007, 01:11 AM
 
Add the following near the top of your .bashrc file in your home folder and you should be set for life (unless you decide to install fink):

code:

export PATH=/bin:/sbin:/usr/local/mysql/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/Developer/Tools


Note: That should be one single line with only one single space after 'export'.
     
MacPC  (op)
Forum Regular
Join Date: Aug 2006
Status: Offline
Reply With Quote
Feb 15, 2007, 02:00 AM
 
Hi, Thanks again for the replies.
Yes Simon, I do have quit long list in the PATH. and itistoday, for some reason in my home directory, it doesn't have the ~/.bashrc file, it has bash_profile and bash_history so I created a bashrc and typed in the code, but I am still getting the same error msg in Darwin. Where does this msg come from anyway?

MacPC.
     
itistoday
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Feb 15, 2007, 02:07 AM
 
Hmm... Make sure PATH is not being set anywhere else. Also, instead of doing:

code:
export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin


Try:
code:
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
     
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 15, 2007, 03:39 AM
 
If you don not have a ~/.bashrc file, you can also put the command in ~/.bash_profile. I don't know if just dumping the command in a ~/.bashrc file will work. My ~/.bash_profile explicitely calls ~/.bashrc. Does your's do that to? If not, add something like this to ~/.bash_profile:

code:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
     
MacPC  (op)
Forum Regular
Join Date: Aug 2006
Status: Offline
Reply With Quote
Feb 15, 2007, 12:02 PM
 
Hi,

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
When I dump this code in the ~/.bash_profile, Terminal gives me another line of error msg.

I was looking through all the bash related files,
In the /etc/bashrc, I have
# System-wide .bashrc file for interactive bash(1) shells.
if [ -n "$PS1" ]; then PS1='\hw \u\$ '; fi
# Make bash check it's window size after a process completes
shopt -s checkwinsize
Not sure what this does.

In my /etc/profile I have
# System-wide .profile for sh(1)
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
Not sure what this does either.
I think the error msg has to do with one of the above files.

In my ~/.bashrc I have
export PATH=/usr/local/mysql/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/Developer/Tools: $PATH
and in my ~/.bash_profile I have
export PATH=/usr/local/mysql/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/Developer/Tools: $PATH
same as ~/.bashrc.

There is also a .bash_history in the /Users?myusername/ but it's blank.

Do they look normal to you guys?

MacPC.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:58 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,