Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/

terminal prob

2»

Comments

  • Closed Accounts Posts: 161 ✭✭pvik00


    /bin/cat /etc/profile
    # System-wide .profile for sh(1)

    if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    fi

    if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
    fi
    export PATH=/opt/local/bin:/opt/local/sbin:$PA TH
    export MANPATH=/opt/local/man:$MANPATH

    and

    /bin/cat /usr/libexec/path_helper
    #!/bin/sh
    #
    # Each line of the text files in /etc/paths are directories that should be
    # added to the current path. We source /etc/paths/default first, so that
    # the default paths (/usr/bin:/bin:/usr/sbin:/sbin) appear early in the path.
    #

    shopt -s extglob
    function read_path_dir () {
    DIR="$1"
    NEWPATH="$2"
    SEP=""
    IFS=$'\n'
    if [ -d "$DIR".d ]; then
    for f in "$DIR" "$DIR".d/* ; do
    if [ -f "$f" ]; then
    for p in $(< "$f") ; do
    "$NEWPATH" = *(*:)${p}*(:*) && continue
    [ ! -z "$NEWPATH" ] && SEP=":"
    NEWPATH="${NEWPATH}${SEP}${p}"
    done
    fi
    done
    fi
    echo $NEWPATH
    }

    P=`read_path_dir /etc/paths "$PATH"`
    MP=`read_path_dir /etc/manpaths "$MANPATH"`

    if [ "$1" == "-c" -o \( -z "$1" -a "${SHELL%csh}" != "$SHELL" \) ]; then
    echo setenv PATH \"$P\"\;
    echo setenv MANPATH \"$MP\"\;
    exit 0
    elif [ "$1" == "-s" -o -z "$1" ]; then
    echo PATH=\"$P\"\; export PATH;
    echo MANPATH=\"$MP\"\; export MANPATH;
    exit 0
    else
    echo "usage: path_helper [-c | -s]" 1>&2
    exit 1
    fi


    i have no idea what any of that means

    No worries man, I can now see what the problem is.

    /etc/profile is misconfigured, the last two lines in particular are not normally there after OS X installation. You may or may not need these entries depending on what you have under /opt, which is also not part of the default os installation.

    These are the lines I'm talking about:
    export PATH=/opt/local/bin:/opt/local/sbin:$PA TH
    export MANPATH=/opt/local/man:$MANPATH

    You have more then one way of fixing this issue but for now let's concentrate on the simplest one.
    Since I have no idea what or who the hell has put these entries into your config, I'll assume that it was some installer and we'll leave it in peace.

    Create a backup copy of /etc/profile and use any text editor to fix the typo on this line:

    export PATH=/opt/local/bin:/opt/local/sbin:$PA TH

    it should read

    export PATH=/opt/local/bin:/opt/local/sbin:$PATH

    You need to save the changes and exit the terminal. The changes above will set the appropriate directories (system binaries) for $PATH, leaving the extra unharmed.


  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    what do i do with the text file - what do i save it as and where?

    do i edit it in the terminal or in textedit for example?



    do i leave the original?



    thanks!


  • Closed Accounts Posts: 161 ✭✭pvik00


    what do i do with the text file - what do i save it as and where?

    do i edit it in the terminal or in textedit for example?



    do i leave the original?



    thanks!

    You can use any text editor you like. Since you said you don't understand shell programming, it's best if you create a backup copy.

    The simplest is to use the Terminal for both operations.

    copy (sudo will prompt for your admin password. just type it, there's no local echo):
    /usr/bin/sudo /bin/cp -p /etc/profile /etc/profile.old


    edit:
    /usr/bin/sudo /usr/bin/vi /etc/profile

    then navigate to the gap at $PA TH, at the end of the file, and once the cursor is on the gap, press x.
    Then press ESC :wq (sequentially, not together) and hit ENTER.
    If you're not comfortable with vi just use any other text editor.


  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    sudo
    -bash: sudo: command not found


    do i need sudo?


  • Closed Accounts Posts: 161 ✭✭pvik00


    sudo
    -bash: sudo: command not found


    do i need sudo?

    root is the owner of /etc/profile, so you either use sudo or authenticate as root using su -

    Since your path is messed up, you need to use the full path for all commands, type them _exactly_ as I wrote them above. sudo is in /usr/bin


  • Advertisement
  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    ~
    W10: Warning: Changing a readonly file
    E325: ATTENTION
    Found a swap file by the name "/private/etc/.profile.swp"
    owned by: root dated: Tue Jun 30 11:49:07 2009
    file name: /private/etc/profile
    modified: YES
    user name: root host name: bobs-macbook-1.local
    process ID: 1138
    While opening file "/private/etc/profile"
    dated: Sat Jun 6 06:34:48 2009

    (1) Another program may be editing the same file.
    If this is the case, be careful not to end up with two
    different instances of the same file when making changes.
    Quit, or continue with caution.

    (2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /private/etc/profile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/private/etc/.profile.swp"
    to avoid this message.

    Press ENTER or type command to continue

    # System-wide .profile for sh(1)

    if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    fi

    if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
    fi
    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    export MANPATH=/opt/local/man:$MANPATH
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~


  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    pvik00 wrote: »
    Then press ESC :wq (sequentially, not together) and hit ENTER.
    If you're not comfortable with vi just use any other text editor.


    when do i press esc?

    where do i type :wq?


    ''E45: 'readonly' option is set (add ! to override)
    ''

    right so i added the exclamation mark

    ''# System-wide .profile for sh(1)

    if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    fi

    if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
    fi
    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    export MANPATH=/opt/local/man:$MANPATH
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    "/etc/profile" [readonly] 11L, 277C''

    no scratch that - things seem to work now

    thanks!!!!


  • Closed Accounts Posts: 161 ✭✭pvik00


    cool stuff.


  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    deriously thanks very very much

    to you and all who helped
    :)


  • Registered Users, Registered Users 2 Posts: 6,828 ✭✭✭Talisman


    Great to see you're finally sorted.


  • Advertisement
  • Closed Accounts Posts: 2,653 ✭✭✭conchubhar1


    indeed


    i am very greatful for all the help i received here - than you all very much


    it took me long to grasp it here where i was being spoonfed - imagine how long it would have taken me on my own if i had ever gotten it at all
    :D


Advertisement