Setting Path's

Discussion in 'Mac Basics and Help' started by span870, Jul 31, 2006.

  1. span870 macrumors newbie

    Joined:
    Jul 31, 2006
    #1
    Hi everyone
    I have a problem and hopefully you guys can help me!
    I'm pretty new to UNIX, but i'm running Mac OSX 10.4.4 and am trying to add some things to my class path in X11.
    My first thought was to try and track down '.profiles' file (as I'm using the BASH shell) and it is non-existent in my home directory...
    After moving up a few directories i found the '/etc/profiles/' file and tried adding to the path using emacs, however it says its read-only...

    I'm using the command
    export PATH="$PATH:Developer/Tools"
    is this right?

    Eventually i would like to add many things to my path, except i dont want to use the above command in the shell everytime, as it seems only temporary

    Can someone help me? I really appreciate it
    Thanks, Simon :)
     
  2. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #2
    Don't add stuff to /etc/profiles.. that's a global file that all shells inherit for all users that open an xterm/Terminal window by default. Changing it could have unintended security implications. For godssake, if you do change it, make a backup of the original first. Wheeo.

    Now.. just make a file called .profiles in your home directory and export the paths you want there.

    Code:
    export PATH=$PATH:/usr/sbin/:/usr/local/bin:/Developer/Tools
    Etc..

    Learn you use Darwin more effectively (and safely): http://osxfaq.com/Tutorials/LearningCenter/index.ws

    Enjoy!
     
  3. span870 thread starter macrumors newbie

    Joined:
    Jul 31, 2006
    #3
    Thanks for your help yellow :)


    just one question though, when I use the command
    echo $PATH, it doesnt seem to have added '/Developer/Tools' to the path?
    is this just my ignorance?


    Thanks
     
  4. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #4
    Did you 1) Open a new xterm/Terminal windows or 2) do: source ~/.profile in your open shell to reload the profile (and therefore the path)?
     
  5. span870 thread starter macrumors newbie

    Joined:
    Jul 31, 2006
    #5
    Thankyou sooo much for your help. It's all working fine now, i didn't realise the .profiles is executed when the shell is initially loaded.

    Here's to becoming a UNIX whiz now!


    cheers, SImon
     
  6. span870 thread starter macrumors newbie

    Joined:
    Jul 31, 2006
    #6
    actually before i get carried away! I didn't even test running a command

    so i reload the .profile file, using the 'source' command, and it seems to have added it to the path:

    :/usr/sbin/:/usr/local/bin/:/Developer/Tools/:/Developer/Applications

    however when i test it out using something like

    open Xcode.app (from my home directory), it says it cant find the file.

    Also when i re-open the shell, it still gives me the old path, and doesnt even appear to execute the .profile file....

    Whats going on?
    I think it may have something to do with the fact that i launch it from the X11 from the dock


    Regards, Simon
     
  7. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #7
    Not sure what to tell you, my X11 implementation reads my ~/.tcshrc just fine.
     

Share This Page