Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminal.app issues ($PATH and starting dir)

Status
Not open for further replies.

eXtremX

Technical User
Mar 10, 2003
56
0
0
PT
Hello,

The other day I was installing a application from source and afterwards I ran into two problems:

- My Terminal.app now always starts with a different directory than my home dir (it does a "cd" to the program source location).

- My $PATH variable is incorrect, I can add new paths by executing ' export PATH="$PATH:/XXX/XXX" ' but I can't seem to make them permanent (I tried adding a line export line to .profile in my home dir)

How can I solve this? And where are the terminal's configuration files stored?

Thanks in advance.
 
I hate to say it, but it depends.

1. What application did you install? Changing your default shell environment is nasty.

2. What are you using as your default shell? In older revisions of OS-X, tcsh was the default and your shell settings were found in Library/init/tcsh. Other possibilities include ksh, zsh, csh, sh and bash.

In newer versions, the default shell is bash and the preferences are in .bashrc in your home directory.

I'm not sure if any shells use .profile anymore.

In any case, it is even possible this nasty app modified your system defaults, in which case you need to check the equivalent file in the /etc/ directory - possibly /etc/bashrc or /etc/csh.cshrc depending on what shell you are using.

 
Forgot to say, I am using bash.

Thanks, I was able to fix my $PATH with the file on /etc/bashrc.

What about the starting dir? Any clue? Didn't find anything on that file related to it...
 
Feh.

Okay - so, Terminals are starting in a different directory than they are supposed to. I assume there were no "cd" commands in your .bashrc or /etc/bashrc.

Other possibilities are:

1. when you type "cd" with no arguments, do you return to your home directory (/Users/eXtremX/) or do you go someplace else? If you go to /Users/eXtremX (or whatever your user account is called) then it sounds like your Terminal preferences have been screwed with.

2. /etc/passwd was changed. To check, open /etc/passwd and look for your user name. On my system, my user name is *not* in there at all - but if yours is, the record should be

username:*:##:##:Real User Name:home directory:shell

3. You have some kind of log in item that's changing your home directory.

4. Something in /etc/profile or /etc/bashrc is changing your $HOME variable.

5. Last thing I can think of - somehow, your home directory got changed in the netinfo database. Unlike old-fashioned Unix, Macs store lots of information in various databases for speed. To access the info, run /Applications/Utilities/Netinfo Manager, and look for yourself in the "users" list. Check your home directory.
 
1- I return to my (correct) home directory when typing cd.
2- My user isnt in /etc/passwd
3- Tried to look for some evidence on logs, but with no results, I'll try to find something.
4- In /etc/profile and /etc/bashrc nothing is changing my $HOME var. Here's what it is:

##
if [ -n "$PS1" ]; then PS1='\h:\w \u\$ '; fi
shopt -s checkwinsize
export PATH="$PATH:/usr/local/bin"
##

5- Nope, my home directory in Netinfo Manager is correct.
 
Sigh. Sorry, I'm out of ideas - you could work around the issue by putting "cd $HOME" as the last line of your ~/.profile, but that could have side effects on other applications.

If I think of anything, I'll post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top