Question

I don't know what has happened, but in my Terminal on Mac OSX 10.5 it can no longer find my sudo command, or find command, etc. They are there because if I put /usr/bin/sudo or /usr/bin/find it works fine...

My .bash_login file looks like this: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH"

My .bash_profile file looks like this: export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.5/site-packages/django_trunk/django/bin:/usr/local/mysql/bin:/usr/bin/sudo$PATH"

I'll say now, I don't really know what I'm doing with the Terminal. I'm just a beginner to it all, and I must of done something for the environment variables (is that what they're called?) to be lost. I presumed I'd just have to make sure the /usr/bin/ path is in my bash files, but they are, and it doesn't seem to work. Please help!

Also, when I do use the /usr/bin/find command, it says "Permission denied" to me, even though I am logged into Mac OSX as the System Administrator account. I don't understand.

Any help would be grand. Thank you - James

Was it helpful?

Solution

It looks like both of your PATH exports are malformed:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH"

The end bit there won't work. It should be:

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:$PATH

Notice the colon before '$PATH'? It's important ;)

Also, the double quotes are not necessary.

If this doesn't work, we will need more information. It is possible that something else is modifying your path even after your shell configurations are loaded.

Can you post the results of:

$ echo $PATH

Configuration files are not always a good indication of the current environment variables, since they are modified by many programs and files, all across your system. To see all of your environment variables, you can run:

$ env

OTHER TIPS

This should fix the problem completely and permanently.

first, export environment paths by using below command in the terminal.

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in

now you have the commands you want. (eg. try ls. You'll see the command is working). But this is only for the current session. If you close the terminal and open a new one, you will have the previous issue. To make this change permanent, use below command,

go to home directory

cd ~

open .bash_profile file in nano / vim (I'm using nano here)

nano .bash_profile

This will open up nano editor. In a new line, paste the following;

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH

press 'control'+'o' to save (WriteOut) and 'control'+'x' to exit nano.

All done ! Now try the commands.

I went trough the same issue and here is how I solved it.

First of all I reverted the file to its original doing this way

/usr/bin/nano ~/.bash_profile

In my case I was not able to make work any command alias. Even vi or vim didnt work without specifying the full path of that command. If nano is not installed just replace nano in the command by the editor installed

After that just restart the computer. In my case as I said bellow I could not use any command. When trying to do /usr/bin/source ~/.bash_profile that command failed. So I had to restart the OS and it worked

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top