PDA

View Full Version : help with terminal




anttyaadiggg
Aug 28, 2013, 11:48 PM
hi everyone,

so recently i was doing lynda's ruby on rails tutorial and i was following the viedo when it was talking about unix and i sort of messed up while in terminal, and im not too sure how to fix this issue so i was thinking maybe someone more experience with terminal and macbook pros would be able to help me. i called apple and they were kinda clueless.. but here is what terminal says everytime i open it. i recently installed homebrew too so maybe that is another one of the issues


Last login: Thu Aug 29 00:27:14 on ttys000
-bash: export: `/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
Anthonys-MacBook-Pro:~ Anthony$

everytime i try and go back into the nano command " nano .bash_profile" it says
-bash: nano: No such file or directory

and even when i type other commands like ll or ls -la it says the same thing. i just wanna make it normal again

any help?? Thank you for your time



Dalton63841
Aug 29, 2013, 12:11 AM
Start terminal, and type the following, then press Enter:

echo $PATH

If is is anything different than the following, put in the next command to fix it.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

I think what you were trying for was to add the "/usr/local/mysql/bin" bit for the installation of MySQL, and to do that just use this:

echo "export PATH=$PATH:/usr/local/mysql/bin" >> ~/.profile && . ~/.profile

anttyaadiggg
Aug 29, 2013, 06:15 PM
sorry for the late response but
when i entered the echo $PATH this is what happen


Anthonys-MacBook-Pro:~ Anthony$ echo $PATH

Anthonys-MacBook-Pro:~ Anthony$

when i add the export PATH=/opt/local/bin:/opt/local/sbin:$PATH part you said this is what happens

Anthonys-MacBook-Pro:~ Anthony$ export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Anthonys-MacBook-Pro:~ Anthony$

its like nothing at all is working i cant even use the nano command to go back into the .bash_profile where i originally where i messed up

Dalton63841
Aug 29, 2013, 06:39 PM
sorry for the late response but
when i entered the echo $PATH this is what happen


Anthonys-MacBook-Pro:~ Anthony$ echo $PATH

Anthonys-MacBook-Pro:~ Anthony$

when i add the export PATH=/opt/local/bin:/opt/local/sbin:$PATH part you said this is what happens

Anthonys-MacBook-Pro:~ Anthony$ export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Anthonys-MacBook-Pro:~ Anthony$

its like nothing at all is working i cant even use the nano command to go back into the .bash_profile where i originally where i messed up

Open Terminal and type:

cat /etc/paths

What does it output?
It should say:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

If it doesn't say that, then type the following to edit it so that it does:
sudo nano /etc/paths

Then, type:

rm -f .bash_profile .profile

This will effectively reset the PATH variable.

anttyaadiggg
Aug 29, 2013, 08:17 PM
i tried the cat /etc/paths and heres the results

Anthonys-MacBook-Pro:~ Anthony$ cat /etc/paths
-bash: cat: No such file or directory

even tried the sudo nano /etc/paths

Anthonys-MacBook-Pro:~ Anthony$ sudo nano /etc/paths
-bash: sudo: No such file or directory

the no such file or directory thing is constant, its pretty much the result i always get even when i try to do other things to see if it fixes it.

something else to add when i put /bin/bash heres the result
Anthonys-MacBook-Pro:~ Anthony$ /bin/bash
bash-3.2$

but even when i do that and try everything you said its still the same results

ElectricSheep
Aug 29, 2013, 08:25 PM
instead of cat /etc/paths, try:

/bin/cat /etc/paths

If you see the output:


/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin


Then you can quickly restore a basic path environment with the command:

eval `/usr/libexec/path_helper -s` (notice the backticks)

anttyaadiggg
Aug 30, 2013, 03:15 PM
when i put in the /bin/cat /etc/paths heres the output

Anthonys-MacBook-Pro:~ Anthony$ /bin/cat /etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

then when i put in the next command heres what happens

Anthonys-MacBook-Pro:~ Anthony$ eval `/usr/libexec/path_helper -s`
Anthonys-MacBook-Pro:~ Anthony$

nothing changed because when i closed terminal and opened a new terminal window it still has this at the top


-bash: export: `/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
Anthonys-MacBook-Pro:~ Anthony$

anttyaadiggg
Aug 30, 2013, 03:43 PM
quick update

i entered

/bin/mv .bash_profile bash_profile_disabled

into the terminal and opened a new terminal window and the invalid identifer message is now gone but now my bash_profile is disabled so i guess what im gonna do is fix the error and then try and re enable it and see if that fixes everything