Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jredecop

macrumors 6502a
Original poster
May 20, 2009
604
15
I had entered a few commands a few months ago trying to root an android phone and now my terminal will not work.
Here is what i get, and if I type in anything, just get errors..

Screenshot2011-02-07at21953PM.png


Now if I type this in, /usr/bin/pico .bash_profile , i can get to this screen

Screenshot2011-02-07at22229PM.png


and this is what i need to delete so that i can get terminal working again..can someone please help me with deleting this profile/command? thanks
 
I was under the impression this forum offered a way to upload and attach pictures. It would be helpful if we could see what issues you're having.
 
I was under the impression this forum offered a way to upload and attach pictures. It would be helpful if we could see what issues you're having.

I uploaded pics in my post, are you not seeing them?

I deleted the info on the second screen now get this when typing /usr/bin/pico .bash_profile

Screenshot2011-02-07at32827PM.png
 
ok, so i deleted this file

/usr/bin/pico

and now my terminal is accepting commands and it looks like this when i open it, this good?

Screenshot2011-02-07at43044PM.png
 
ok, so i deleted this file

/usr/bin/pico

and now my terminal is accepting commands and it looks like this when i open it, this good?

Screenshot2011-02-07at43044PM.png

Have no idea what you're doing or what the problem is. pico is an editor; you shouldn't delete it. Can you please stop posting images and let us know what you are doing?
 
Have no idea what you're doing or what the problem is. pico is an editor; you shouldn't delete it. Can you please stop posting images and let us know what you are doing?

Sorry..what i did is go into the terminal and type in this command, /usr/bin/pico .bash_profile and what i tried is deleting the

"export PATH=$
{PATH}:sdkfolder>/tools"

Screenshot2011-02-07at22229PM.png


I THEN went and deleted /usr/bin/pico file. At that point I closed terminal and reopened it. The error that I kept getting before I did this

"-bash: sdkfolder: No such file or directory"

went away. But I didnt feel right about deleting the pico file, so I put it back.
My terminal now seems to be functions properly, which probably has to do with deleting the

"export PATH=$
{PATH}:sdkfolder>/tools"

wording and hitting save. Thanks for all your help. I can now go in and enter commands and it will accept them. Thanks for your time and help.
 
There is no need to bother with images.

You can let us know what is going on by simply typing what you type in terminal right here in the forum. You can copy and paste from terminal right in to your browser.

Anyway. After reading your posts, I decided to take a look at what's in my .bash_profile. Nothing. Nada. The file does not exist. Try renaming .bash_profile to NOT.bash_profile. This should prevent it from being "sourced" when you launch a terminal. You can immediately test it by simply typing bash at the $ prompt. It would go something like this...

$ mv .bash_profile NOT.bash_profile
$ bash

So while I know you managed to get things working, you didn't have to use pico to edit .bash_profile. You could merely rename it so the OS wouldn't find it. I'm glad you "put pico back" though I'm not sure how you did that. You should never go around deleting things in /usr/bin. The terminal is a very dangerous place. You can make your Mac very stupid very quickly by messing things up in terminal. The terminal is a very powerful place. You can customize OS X to your heart's content in terminal, more than the themes, gadgets and various band aids windows users can resort to. So if after hearing how dangerous terminal is you want to use the terminal anyway...

So how do you protect yourself from yourself? If bash asks for your password, think about it. Better yet, ctrl-c out of it and come back later after making sure you weren't about to \rm -rf * or while (1) fork.

Take some time and go through a few online Unix tutorials like this one so you know what dot files are and familiarize yourself with the bash shell and basic scripting. A good book to read is Learning the bash Shell By Cameron Newham, Bill Rosenblatt. It's available as an ebook from google for $15, readable in your browser or on any iThing. You can read quite a bit of it by previewing in google books before you decide whether to buy it.
 
Ok thanks. Sorry I'm obvisouly new at this, just trying to fix this and thank you for your help. Here what I get when entering what you typed

Last login: Mon Feb 7 23:39:02 on ttys000
unknownf81edfe9dc93:~ jredecop$ bash
bash-3.2$ mv .bash_profile NOT.bash_profile
mv: rename .bash_profile to NOT.bash_profile: No such file or directory
bash-3.2$
 
Don't delete pico. It's your text editor--not a script.

Next, <sdkfolder> has no meaning to your shell. This is something that's used by Xcode on a per-target level, and it's not something that's available to a normal Terminal window.

Lastly, your export command is spread across two lines and wouldn't work anyway. You're borking your PATH variable.


Only one of your images is visible to me, and that's the last one. As a result, everything else you've said is effectively gibberish. So, let's start over. What are you trying to do?
 
What are you trying to do?

Anytime I entered a command in terminal I got this message

-bash: sdkfolder: No such file or directory

and thats as far as it would go. Trying to get around that. I have it to where terminal is working now but something still looks wrong...whats the unknown here

Last login: Mon Feb 7 23:46:06 on ttys000
unknownf81edfe9dc93:~ jredecop$
 
Anytime I entered a command in terminal I got this message

-bash: sdkfolder: No such file or directory

and thats as far as it would go. Trying to get around that. I have it to where terminal is working now but something still looks wrong...whats the unknown here

Last login: Mon Feb 7 23:46:06 on ttys000
unknownf81edfe9dc93:~ jredecop$

Where "unknownf81edfe9dc9" is showing up should be the hostname of your Mac. In my case it looks like this...

Last login: Tue Feb 8 00:05:58 on ttys000
r0ksMac:~ r0k$


If I type cd Documents, it now looks like this:
r0ksMac: Documents r0k$

What you see is hostname: folder user $ or # depending whether you are a user or root. I don't recommend enabling your root account as an inexperienced Unix user. That's an express ticket to nowhere!

The ~ above is a shortcut that means you are sitting in your "home folder". I'm glad to hear you didn't have a .bash_profile. It's something you don't absolutely need. It's a "startup" script that runs whenever you start a new bash shell and I mean every time. Any command you run first tries to run a bash shell and if there is something mixed up in .bash_profile the command never gets to run. It's best not to have that file around at all. One thing that's not clear is what are you trying to accomplish in terminal in the first place? Just tinkering? Learning about Unix? I really like OS X because I can tinker in terminal whenever I like and it's so much like Linux. I also like OS X because I don't have to bother with terminal unless I feel like it. So again I'm curious about why you are using terminal in the first place?
 
OP, you obviously don't know much about the terminal. The terminal can be a dangerous place if you are just typing random commands from some website and you don't even know what they do. Be careful!!

What does it say when you type "cat .bash_profile"?
If it returns nothing then your profile is empty like it should be.
If it has something, what is in it?

To get back to square one you can rename your profile like r0k said.
mv .bash_profile NOT.bash_profile
touch .bash_profile
The mv command will take your current .bash_profile and rename it
The touch command will create a new blank .bash profile (The way it defaults in Mac OSX)
 
OP, you obviously don't know much about the terminal. The terminal can be a dangerous place if you are just typing random commands from some website and you don't even know what they do. Be careful!!

What does it say when you type "cat .bash_profile"?
If it returns nothing then your profile is empty like it should be.
If it has something, what is in it?

To get back to square one you can rename your profile like r0k said.
mv .bash_profile NOT.bash_profile
touch .bash_profile
The mv command will take your current .bash_profile and rename it
The touch command will create a new blank .bash profile (The way it defaults in Mac OSX)

I'm new to using terminal and am having a similar problem while trying to do a Ruby on Rails tutorial. I think something got corrupted in my .bash_profile, but none of the commands—ls, cd, mv, etc.—are working anymore. Here's a look at the last few lines in terminal:

park-silkensons-macbook-pro:~ park$ ruby -v
-bash: ruby: command not found
park-silkensons-macbook-pro:~ park$ man bash
-bash: man: command not found
park-silkensons-macbook-pro:~ park$ /bin/echo $PATH
/usr/local/git/bin
park-silkensons-macbook-pro:~ park$ cat .bash_profile
-bash: cat: command not found
park-silkensons-macbook-pro:~ park$ mv .bash_profile NOT.bash_profile
-bash: mv: command not found

Does that make sense to anyone? I also tried opening the .bash_profile to edit it, but the terminal commands for that return "command not found" errors also. I was able to open the file in TextEdit, but it was locked so I couldn't change it. Here's what was inside the file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

PATH=$PATH:~/bin
export PATH
export PATH=/usr/local/git/bin

Any help?
 
you have to specify the full path to the command (mv, cd, etc) like so:
Code:
/bin/mv

relaunch Terminal

if you need to recreate it, put this in it
Code:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH
 
Thanks, but my .bash_profile file is not inside /bin, it's just inside my home directory. So is that still what I need to do?

ScreenShot2012-06-16at75350AM.png
 
you have to specify the full path to the command (mv, cd, etc) like so:
Code:
/bin/mv

Like so
Code:
/bin/mv .bash_profile .broken_bash_profile
or
/bin/rm .bash_profile

But you are right that it is a good idea to specify the full path to the file as well
Code:
/bin/mv ~/.bash_profile .broken_bash_profile
or
/bin/rm ~/.bash_profile
~/ always points to the home directory of the current user
/bin/rm is remove/delete
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.