Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 9, 2013, 09:36 AM   #1
ProgrammerNewb
macrumors newbie
 
Join Date: Jan 2013
Terminal Problems- I couldn't do the command mkdir

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
ProgrammerNewb is offline   0 Reply With Quote
Old Jan 9, 2013, 10:14 AM   #2
r0k
macrumors 68040
 
r0k's Avatar
 
Join Date: Mar 2008
Location: 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.
__________________
-r0k
Macbook Pro (late 2011) + iPad mini + iPhone5 + (GS4 for work)
Got a scan to ftp scanner? Enable ftpd in Lion/Mavericks/Yosemite!
r0k is offline   0 Reply With Quote
Old Jan 9, 2013, 11:19 AM   #3
ProgrammerNewb
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
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?
ProgrammerNewb is offline   0 Reply With Quote
Old Jan 9, 2013, 02:01 PM   #4
r0k
macrumors 68040
 
r0k's Avatar
 
Join Date: Mar 2008
Location: Detroit
Quote:
Originally Posted by ProgrammerNewb View Post
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).
__________________
-r0k
Macbook Pro (late 2011) + iPad mini + iPhone5 + (GS4 for work)
Got a scan to ftp scanner? Enable ftpd in Lion/Mavericks/Yosemite!
r0k is offline   0 Reply With Quote
Old Jan 9, 2013, 06:28 PM   #5
ProgrammerNewb
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
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?
ProgrammerNewb is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
UUID Command in Terminal? cdoolittle17 Mac Programming 3 Feb 28, 2014 01:54 PM
Mail command in Terminal lukestroh OS X Mavericks (10.9) 6 Dec 2, 2013 09:14 PM
Terminal command error Ddyracer OS X 10.8 Mountain Lion 7 Aug 27, 2013 10:51 AM
Terminal command andynewfriends Mac Basics and Help 0 Jun 11, 2013 02:25 PM
Need command in terminal chadteetzen OS X 1 Jun 8, 2012 11:55 PM

Forum Jump

All times are GMT -5. The time now is 05:11 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC