FINK and the terminal.

Posted:
in Genius Bar edited January 2014
Hello i am trying to fool arounf with fink and unix a bit with the terminal. I recently installed FINK and everytime I launch the terminal i get the followong printed in the shell.

_____________________________________

/sw/bin/pathsetup.command; exit

Welcome to Darwin!

[Nicks-Computer:~] nickpulido% /sw/bin/pathsetup.command; exit



Your environment seems to be correctly

set up for Fink already.







(You can close this window now)







logout

[Process completed]

_____________________________________



and it wont let me type anything. Even when i opne a new sheel, or restart. How do I fix this?



Thanks,

NIck



Comments

  • Reply 1 of 18
    baumanbauman Posts: 1,248member
    Fink installs a few files that change the way your shell operates. Specifically, it changes the directory that the shell looks in for commands.



    It seems like something in the fink config file went awry. To check this, take a look at several files:



    Your home directory probably has a hidden file called .cshrc. To see the contents, type... oh wait... you don't have access to the terminal.



    Hmmm. Heheh.



    OK. Here's what you do:



    Open up the terminal, go to File:New Command, and type bash. Now, there should be a terminal window that opens, and this one shouldn't close out.



    Now that you have a terminal window, you can take a look around. Type "cat ~/.cshrc" to take a look at one of your config files. You should get something like:

    Code:


    bash-2.05a$ cat ~/.cshrc

    source /sw/bin/init.csh







    Pay attention to where the source path is pointing you. On mine it's like this, but it could be different for you. So, do a "cat /sw/bin/init.csh", or wherever the source points you to. Then post the result that gives you, and hopefully we'll get this sorted out.
  • Reply 2 of 18
    Quote:

    Originally posted by bauman

    Fink installs a few files that change the way your shell operates. Specifically, it changes the directory that the shell looks in for commands.



    It seems like something in the fink config file went awry. To check this, take a look at several files:



    Your home directory probably has a hidden file called .cshrc. To see the contents, type... oh wait... you don't have access to the terminal.



    Hmmm. Heheh.



    OK. Here's what you do:



    Open up the terminal, go to File:New Command, and type bash. Now, there should be a terminal window that opens, and this one shouldn't close out.



    Now that you have a terminal window, you can take a look around. Type "cat ~/.cshrc" to take a look at one of your config files. You should get something like:

    Code:


    bash-2.05a$ cat ~/.cshrc

    source /sw/bin/init.csh







    Pay attention to where the source path is pointing you. On mine it's like this, but it could be different for you. So, do a "cat /sw/bin/init.csh", or wherever the source points you to. Then post the result that gives you, and hopefully we'll get this sorted out.



    I really appreciate your response. This is what happened after i entered what you said.

    ________________________________

    bash-2.05a$ cat ~/.cshrc

    source /sw/bin/init.csh

    bash-2.05a$

    ________________________________



    same as yours.??
  • Reply 3 of 18
    baumanbauman Posts: 1,248member
    Yup. That's the same. Now let's look at the file it points to:



    Type: "cat /sw/bin/init.csh"
  • Reply 4 of 18
    Quote:

    Originally posted by bauman

    Yup. That's the same. Now let's look at the file it points to:



    Type: "cat /sw/bin/init.csh"




    This is what i get.



    __________________________________________________ ___

    # init.csh

    #

    # to use the Fink hierarchy, put the following in your .cshrc:

    #

    # source /sw/bin/init.csh

    #



    #

    # Fink - a package manager that downloads source and installs it

    # Copyright (c) 2001 Christoph Pfisterer

    # Copyright (c) 2001-2003 The Fink Team

    #

    # This program is free software; you can redistribute it and/or

    # modify it under the terms of the GNU General Public License

    # as published by the Free Software Foundation; either version 2

    # of the License, or (at your option) any later version.

    #

    # This program is distributed in the hope that it will be useful,

    # but WITHOUT ANY WARRANTY; without even the implied warranty of

    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

    # GNU General Public License for more details.

    #

    # You should have received a copy of the GNU General Public License

    # along with this program; if not, write to the Free Software

    # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

    #



    # define append_path and prepend_path to add directory paths, e.g. PATH, MANPATH.

    # add to end of path

    alias append_path 'if ( $\\!:1 !~ \\!:2\\:* && $\\!:1 !~ *\\\!:2\\:* && $\\!:1 !~ *\\\!:2 && $\\!:1 !~ \\!:2 ) setenv \\!:1 ${\\!:1}\\\!:2'

    # add to front of path

    alias prepend_path 'if ( $\\!:1 !~ \\!:2\\:* && $\\!:1 !~ *\\\!:2\\:* && $\\!:1 !~ *\\\!:2 && $\\!:1 !~ \\!:2 ) setenv \\!:1 \\!:2\\:${\\!:1}; if ( $\\!:1 !~ \\!:2\\:* ) setenv \\!:1 \\!:2`echo \\:${\\!:1} | /usr/bin/sed -e s%^\\!:2\\:%% -e s%\!:2\\:%:%g -e s%\!:2\\$%%`'



    # setup fink related paths. we assume that the fink directories exists.

    if ( $?PATH ) then

    prepend_path PATH /sw/bin:/sw/sbin

    else

    setenv PATH /sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin

    endif



    if ( $?MANPATH) then

    prepend_path MANPATH /sw/share/man

    else

    setenv MANPATH `/usr/bin/manpath -q`

    prepend_path MANPATH /sw/share/man

    endif



    if ( $?INFOPATH ) then

    prepend_path INFOPATH /sw/share/info:/sw/info

    else

    setenv INFOPATH /sw/share/info:/sw/info:/usr/share/info

    endif



    if ( -r /sw/share/java/classpath ) then

    if ( $?CLASSPATH ) then

    set add2classpath = `cat /sw/share/java/classpath`

    prepend_path CLASSPATH $add2classpath

    else

    setenv CLASSPATH `cat /sw/share/java/classpath`

    endif

    endif



    if ( $?PERL5LIB ) then

    prepend_path PERL5LIB /sw/lib/perl5

    else

    setenv PERL5LIB /sw/lib/perl5

    endif



    # Add X11 paths (but only if the directories are readable)

    if ( -r /usr/X11R6/bin ) then

    append_path PATH /usr/X11R6/bin

    endif

    if ( -r /usr/X11R6/man ) then

    append_path MANPATH /usr/X11R6/man

    endif



    # read per-package scripts from /sw/etc/profile.d

    if ( -d /sw/etc/profile.d ) then

    set nonomatch

    foreach i ( /sw/etc/profile.d/*.csh )

    if ( -x $i ) then

    source $i

    endif

    end

    unset i nonomatch

    endif



    if ($?version) then

    if ("$version" =~ tcsh*) then

    complete fink 'n/fink/(install remove selfupdate update-all configure list apropos describe --help --version)/'

    endif

    endif



    set PROXYHTTP=`grep ProxyHTTP /sw/etc/fink.conf | grep -v "#" | cut -d " " -f2`



    if ( "$PROXYHTTP" != "" ) then

    setenv HTTP_PROXY $PROXYHTTP

    setenv http_proxy $PROXYHTTP

    endif



    set PROXYFTP=`grep ProxyFTP /sw/etc/fink.conf | grep -v "#" | cut -d " " -f2`



    if ( "$PROXYFTP" != "" ) then

    setenv FTP_PROXY $PROXYFTP

    setenv ftp_proxy $PROXYFTP

    endif



    # eof



    ___________________________________________





    Thanks,

    Nick
  • Reply 5 of 18
    baumanbauman Posts: 1,248member
    Hmm... That looks ok. That's where I thought the problem would lie, but it doesn't look like it.



    Ok, well, I'll have you try a bunch of things now.



    Just to let you know what I'm doing, here's an excerpt from the man page for tcsh, your shell. (I've been having you run commands from bash, a different shell)

    Quote:

    Startup and shutdown

    A login shell begins by executing commands from the system

    files /etc/csh.cshrc and /etc/csh.login. It then executes

    commands from files in the user's home directory: first

    ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc,

    then ~/.history (or the value of the histfile shell vari-

    able), then ~/.login, and finally ~/.cshdirs (or the value

    of the dirsfile shell variable) (+).



    So, we've looked at the .cshrc file, and the file it points to, but now take a look at all the others it talks about.



    cat ~/.tcshrc should just return "source .cshrc"



    Also try:

    cat /etc/csh.cshrc

    cat /etc/csh.login

    cat ~/.login



    Also take a look at:

    ls /sw/etc/profile.d/



    Hopefully we'll get this sorted out
  • Reply 6 of 18
    Thanks You so much for helping me with this:



    Here are the responses I got after typing what you told me. The first one might be the culprit since it says "No such file or directory" But your the unix expert so what do you see?



    __________________________________________________ ________

    bash-2.05a$ cat ~/.tcshrc

    cat: /Users/nickpulido/.tcshrc: No such file or directory

    bash-2.05a$ cat /etc/csh.cshrc

    # System-wide .cshrc file for csh(1).



    if ($?prompt) then

    set promptchars = "%#"

    if ($?tcsh) then

    set prompt = "[%m:%c3] %n%# "

    else

    set prompt = "[%m:%c3] `id -nu`%# "

    endif

    endif

    bash-2.05a$ cat /etc/csh.login

    # System-wide .login file for csh(1).



    setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin"

    bash-2.05a$ cat ~/.login

    cat: /Users/nickpulido/.login: No such file or directory

    bash-2.05a$

    bash-2.05a$ ls /sw/etc/profile.d/

    dummy.sh

    bash-2.05a$

    bash-2.05a$



    __________________________________________________ _____
  • Reply 7 of 18
    Check your terminal preferences... mine look like this.



  • Reply 8 of 18
    baumanbauman Posts: 1,248member
    Quote:

    Originally posted by Gargoyle

    Check your terminal preferences... mine look like this.



    /me hits forehead.



    Good call. That's gotta be where the problem is. By the way, all your login stuff looks fine. It will only read from a file if it exists, so it's all good.
  • Reply 9 of 18
    Quote:

    Originally posted by bauman

    /me hits forehead.



    Good call. That's gotta be where the problem is. By the way, all your login stuff looks fine. It will only read from a file if it exists, so it's all good.




    Timeout my prefs look the same. PS. How do i fix this.
  • Reply 10 of 18
    baumanbauman Posts: 1,248member
    One more. This has got to be it, or else I have absolutely no idea what's happening.



    type 'cat /etc/rc.common'



    I sure hope this one is it.
  • Reply 11 of 18
    Quote:

    Originally posted by bauman

    One more. This has got to be it, or else I have absolutely no idea what's happening.



    type 'cat /etc/motd'



    I sure hope this one is it.






    It says Welcome to darwin.
  • Reply 12 of 18
    baumanbauman Posts: 1,248member
    I'm out. I got no idea at all.



    Sorry, maybe someone else could help, but the problem isn't with the shell, as far as I can tell.



    Verify this by doing the run command, and typing tcsh.



    It's gotta be the terminal that's running the command, and if your pref window looks like the screenshot above, I don't know where to fix it.



    \
  • Reply 13 of 18
    Quote:

    Originally posted by bauman

    I'm out. I got no idea at all.



    Sorry, maybe someone else could help, but the problem isn't with the shell, as far as I can tell.



    Verify this by doing the run command, and typing tcsh.



    It's gotta be the terminal that's running the command, and if your pref window looks like the screenshot above, I don't know where to fix it.



    \




    When i run a bash shell and then opne "/bin/tcsh" everything is fine...very odd.



    Thanks so much, i appreciate all your help, im sure ill sort it out evntually.
  • Reply 14 of 18
    baumanbauman Posts: 1,248member
    Here's a last ditch effort, and it would only be a temporary solution if it works.



    type 'sudo mv /sw/bin/pathsetup.command /sw/bin/pathsetup.command.old'



    What this will do is break the command before the exit is given, and although I think it will spew a bunch of junk (like 'file does not exist') on your terminal, I hope it will at least work.
  • Reply 15 of 18
    Quote:

    Originally posted by bauman

    Here's a last ditch effort, and it would only be a temporary solution if it works.



    type 'sudo mv /sw/bin/pathsetup.command /sw/bin/pathsetup.command.old'



    What this will do is break the command before the exit is given, and although I think it will spew a bunch of junk (like 'file does not exist') on your terminal, I hope it will at least work.




    Ok i did it and it gets rid of the fink stuf but it still says process completed and logs out. Tell me if this is possible...OK when i am in a bash shell i can change to a tcsh shell so could we write a .term file that first opens a bash shell only to change in to a tcsh shell and have the .term file run on startup of the terminal?
  • Reply 16 of 18
    i have an pretty long-winded idea to figure out this problem. Terminal is looking somewhere on ur comp, to open your shell, and somewhere along the line is executing pathsetup.command (which it doesn't need to). so, since we tried .tcshrc and .cshrc and similars, and didn't find the problem, we can do a more exhaustive search.



    if you drop into a bash shell, then type:

    Code:


    grep -rn /sw/bin/pathsetup.command / 2>/dev/null





    then <enter>, 'grep' will search through your whole hard drive and return all files that contain the search phrase ('/sw/bin/pathsetup.command'). it may take a while, so while its working, grab a smoke or watch a little t.v. when its done (and ur sitting at a new prompt), you can peer through its results. they'll be formatted something like this:

    file name:line number <line matching search string>



    files like 'README' or that end in .txt are probably not bad. Any errors grep spits out shouldn't concern you either (grep often tries to go into folders it doesn't have permission for, or that don't contain readable files). i suggest you post back what the results are, and hopefully we'll be a little closer to fixing this problem.
  • Reply 17 of 18
    i just got another idea. since you moved the .command file out of the way, and since it is still trying to execute it, you can do this. in bash, type:

    Code:


    sudo -s;

    echo '#!/bin/sh' > /sw/bin/pathsetup.command

    echo 'tcsh -i' >> /sw/bin/pathsetup.command

    exit





    after the 'sudo -s' line you will probably be asked for your password. if you already were superuser, then forget the first and last lines.



    now, you will have a file in the old pathsetup.command place, but your new version starts up a tcsh shell. so when terminal tries to open /sw/bin/pathsetup.command, it will give you a tcsh shell. this may be a good enough kludge for you. but, if u want to get to the root of the problem, you can type 'ps'. that will print out a listing of all the current running programs. if you post that output back to us, we may be able to figure out which of these programs actually started this ruckus in the first place.
  • Reply 18 of 18
    These are the programs running.



    PID TT STAT TIME COMMAND

    766 std S 0:00.06 -tcsh (tcsh)

    774 std S 0:00.01 bash



    I am starting the grep searh now
Sign In or Register to comment.