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

Oipiah

macrumors newbie
Original poster
Jun 6, 2011
4
0
You're all gonna laugh, but I have been modifying the ~/.profile , /etc/paths , and /etc/paths.d files, and now none of the unix commands work in the terminal except for cd (as far as I can tell.) I don't think it was modifying the ~/.profile that did anything because I have been told that that file is initially blank. Could someone please tell me which file I modified that screwed everything up and also how to get that file back to normal?

Thanks!
Cody
 
Also, when I open terminal this is printed
dirname: illegal option -- b
usage: dirname path
basename: illegal option -- b
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
 
What did you do exactly and what made you want to mess with /etc/paths????
 
After you open terminal, try entering this command.

Code:
export PATH=/usr/bin:/usr/sbin:/bin:/sbin

This should restore access to the commands temporarily.

The errors look like issues with the commands in your ~/.profile and/or ~/.bashrc files.

It's after horse has bolted, but whenever you playing around with kind of stuff, leave a second Terminal window open before you start. Then when you break your bash environment, you can use the second Terminal window to fix it.

It might also be wise to have a second tab in the second window running sudo -s just in case you need Admin privileges to fix the break.
 
Dunno if sudo will still work but you can open a text editor with sudo "/Applications/TextEdit.app/Contents/MacOS/TextEdit" and open /etc/paths and set it to the original paths:

Code:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

Export additional via your ~/.profile with EXPORT PATH = $PATH:/path/to/bin
not by editing the system defaults.

By default /etc/paths.d/ should only contain X11 with the content:
Code:
/usr/X11/bin
 
Thank You! that worked! I was messing around with /etc/paths b/c I was told that was the way to hard-wire in aliases. However, I have still not been able to get that to work. Any suggestions?
 
Thank You! that worked! I was messing around with /etc/paths b/c I was told that was the way to hard-wire in aliases. However, I have still not been able to get that to work. Any suggestions?

WTF. That's soooo not the way to do that.

Aliases should be put into ~/.bashrc. ~/.profile should source ~/.bashrc at the top.

BTW I've assumed you're talking about Bash aliases, not Finder aliases.
 
Just for illustration a real example of a additional path being added and an alias being added:

Code:
Hansi:~ hansi$ cat .profile
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
alias showListeners="lsof -i -P | grep LISTEN"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.