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

ProgrammerNewb

macrumors newbie
Original poster
Jan 9, 2013
3
0
I noticed i couldn't do mkdir after trying to install github. so i navigated the forums for a solution. I believed i messed it up. i tried to trash the apple.Terminal.plist, but that didn't work. i have my directories messed up and i may have deleted some important stuff. please help

I tried this export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" for a temporary use of mkdir and what not

but i think i did something really bad when i tried rm ~/.bash_profile; touch ~/.bash_profile; echo 'export PATH=$PATH:/(name of some important file that i forget)>> ~/.bash_profile

:~[102] > export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"

:~[104] > cat ~/.profile
cat: /Users/mycomp/.profile: No such file or directory

:~[105] > ~/.bashrc file
-bash: /Users/mycomp/.bashrc: No such file or directory

:~[106] > /root/.bashrc
-bash: /root/.bashrc: No such file or directory

:~[107] > /root/.profile
-bash: /root/.profile: No such file or directory

:~[108] > ~/.profile
-bash: /Users/mycomp/.profile: No such file or directory

:~[109] > /etc/profile
-bash: /etc/profile: Permission denied

:~[110] > /etc/bash.bashrc
-bash: /etc/bash.bashrc: No such file or directory

:~[111] > echo $SHELL; echo $PATH; which dirname basename
/bin/bash
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
/usr/bin/dirname
/usr/bin/basename
 

r0k

macrumors 68040
Mar 3, 2008
3,611
75
Detroit
Try this...

cd /bin
./which mkdir

if it's not there try
cd /usr/bin
./which mkdir

you can then run mkdir with its full path, something like

/bin/mkdir whatever

of course you need to repair all the violence you did to your profile but the ability to use mkdir doesn't depend on paths. You just need to figure out where the mkdir command is located. I suggest you get someone to give you their path so you can reconstruct your path and undo the damage you did by deleting the profile. I believe that if your profile is missing there is a system default, possibly in /etc or in /private/etc.

Whatever you do, AVOID modifying any system files outside your home directory.

DOH!

As long as you haven't done anything to system files outside your home folder, you can recover from this without any outside assistance...

Create a separate user account.
It can be an ordinary or an admin user.
Log in as the new user.
Open terminal and check the path.
Copy that path to /user/shared then log back in as yourself and repair the damage to your profile files.
 

ProgrammerNewb

macrumors newbie
Original poster
Jan 9, 2013
3
0
i'll know better next time than to ever remove anything

so i made another user, but what should i be checking for? how can i implement those changes?
 

r0k

macrumors 68040
Mar 3, 2008
3,611
75
Detroit
i'll know better next time than to ever remove anything

so i made another user, but what should i be checking for? how can i implement those changes?

Logged in as the new user, launch terminal and type:

Code:
mkdir test

It should work. If it does work, then you know the only broken thing is something in your home folder in your other account.

Next you can do (in your new user's home folder)

Code:
ls -al

The switch users to your real account and in your real home folder do...

Code:
ls -al

You should see what files are missing or are 0 length (created with the touch command after deleting the real ones). There are several possibilities as to which are missing, but the following example assumes the only missing file is .bash_profile To put them back you have several options. You can do something like this:

Code:
cp .bash_profile /users/shared/dotbash_profile
Then switch users to yourself and go to your home folder where you deleted .bash_profile and type:

Code:
cp /users/shared/dotbash_profile ~/.bash_profile

I would repeat this for any dot files other than .DS_STORE which is nothing but a nuisance. Caution: only copy files from the test account if you are convinced you deleted those same files in your own folder or that you created empty versions in your home folder (using the touch command).
 

ProgrammerNewb

macrumors newbie
Original poster
Jan 9, 2013
3
0
Next you can do (in your new user's home folder)

Code:
ls -al

The switch users to your real account and in your real home folder do...

Code:
ls -al

You should see what files are missing or are 0 length (created with the touch command after deleting the real ones). There are several possibilities as to which are missing, but the following example assumes the only missing file is .bash_profile To put them back you have several options. You can do something like this:

Code:
cp .bash_profile /users/shared/dotbash_profile
Then switch users to yourself and go to your home folder where you deleted .bash_profile and type:

Code:
cp /users/shared/dotbash_profile ~/.bash_profile

I would repeat this for any dot files other than .DS_STORE which is nothing but a nuisance. Caution: only copy files from the test account if you are convinced you deleted those same files in your own folder or that you created empty versions in your home folder (using the touch command).[/QUOTE]

typing ls -al works in the temporary account, but when I go back to the original account to do this, it says that -bash: ls: command not found. What should I do now?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.