usr/local/bin

Discussion in 'Mac Programming' started by SHankara, Dec 12, 2007.

  1. macrumors member

    Joined:
    Oct 5, 2007
    #1
    why doesnt osx come with this directory already?Or do you have to sudo mkdir it yourself?
     
  2. macrumors 68020

    samh004

    Joined:
    Mar 1, 2004
    Location:
    Australia
    #2
    I would imagine it'd be hidden so idiots can't screw things up (not implying you). You could try pressing Command + G and then typing the path exactly as you typed here, that might get you there...

    Or you could go into Terminal and show hidden files and folders.
     
  3. thread starter macrumors member

    Joined:
    Oct 5, 2007
    #3
    no its not there,I was wondering why it wouldnt already be there for anybody who wants their own binaries installed there
     
  4. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    Because 99.9% of Mac users wouldn't have a clue what you were talking about if you mentioned /usr/local/bin. Apple have probably just decided that those who do know about it also know how to create the directories themselves. Seems reasonable to me.
     
  5. macrumors regular

    Joined:
    Feb 27, 2006
    #5
    I noticed that too, when I first got my MacBook 10.4.9. I was also surprised because it is quite common in the unix world!

    Anyways, you can create it yourself like I did (yes, sudo mkdir /usr/local/bin will work). Or if you use FINK (or darwin ports) some of the programs you install will automatically generate that folder.

    Cheers,
    ScKaSx
     
  6. macrumors 68000

    Joined:
    Feb 23, 2006
    #6
  7. macrumors newbie

    Joined:
    Feb 3, 2009
    #7
    I am new to using terminal but..

    i think you will find your usr/local/bin folder if you drop back a few directories

    When I load up terminal it starts me in my user folder (Users/MacPro/) if you:

    cd ../../
    ls

    you will see the usr folder listed
     
  8. macrumors regular

    Joined:
    Jul 23, 2002
    #8
    It is my understanding that /usr/local is meant to hold things that an administrator installs on a system, separate from what's included in a vanilla install. Perhaps Apple follows this convention literally. By definition, if you haven't installed any binaries or libraries, you have a vanilla install and thus wouldn't have anything in /usr/local.

    crackpip
     
  9. macrumors regular

    GroovyLinuxGuy

    Joined:
    Apr 2, 2006
    Location:
    Canada
    #9

    I just create /usr/local/bin as soon as I do an install, but most of my scripts live in bin in my home directory. If you make it, OS X will include it in its $PATH automatically (at least I don't remember adding it to $PATH).
     
  10. macrumors regular

    Joined:
    Jul 23, 2002
    #10
    Nothing wrong with that unless you have a bunch of other users using your binaries.

    On a couple of my machines I have to use special versions of the kerberos binaries, and kerberized versions of openSSH. I stick those in /usr/local/bin so that I don't overwrite the default versions in case it would screw with OS X. But, they are still easily available to other users.

    crackpip
     
  11. macrumors regular

    GroovyLinuxGuy

    Joined:
    Apr 2, 2006
    Location:
    Canada
    #11
    No...those are my binaries...go away and get your own... :D

    True enough, I was thinking on more of a single user system, I don't know why, but that was the impression that I got from the original post. Just to add, I usually create an /opt directory as well to put bigger packages in and symlink them back to /usr/local/bin for convenience
     
  12. webfoot, Jul 20, 2011
    Last edited by a moderator: Jul 20, 2011

    macrumors newbie

    Joined:
    Jul 20, 2011
    #12
    Hi,

    I actually know nothing about this (I am a graphic designer), however my "Computer Savvy" 9 1/2 year old son would like to offer the following suggestions:

    "Hi, To go into the usr/local/bin directory open Terminal then type (In 1 line)
    "cd ../..; cd usr; open ." Then hit enter. It will open a new finder window that is directly inside the usr folder. Then you can double click on local then bin to go into usr/local/bin. Just to tell you guys the usr folder is invisible and is only visible in Terminal. I hope this helps! I bet you are surprised about how young I am. From, Justin"

    Hi this is Justin again,

    To go to the opt folder: Open a new Terminal window type (In 1 line)
    "cd ../..; cd opt; open ."
    This will also open a new finder window that will have the opt folder opened without you having to make it.
     
  13. macrumors 6502a

    Joined:
    Apr 1, 2007
    #13
    cd ../.. is not needed cd /usr or /opt is simpler. Open . will not create a folder it will just open a new Finder window in the current folder. /usr/local/bin should be created manually because will MacOSX doesn't ship with any user specific binaries, ergo create it once needed.
     
  14. chown33, Jul 20, 2011
    Last edited: Jul 20, 2011

    macrumors 603

    Joined:
    Aug 9, 2009
    #14
    No cd is needed at all. This suffices:
    Code:
    open /usr
    
    Also:
    Code:
    mkdir -p /usr/local/bin
    
    It creates intermediate directories as needed. So if /usr/local doesn't exist, it creates it. If it does exist, it uses the existing one.



    And when I was 9 1/2 I was into things made from old clock mainsprings (several types of GI Joe crossbow come to mind), chemistry, lenses, and ants. These might not be something you'd mention to an actual 9 1/2-year-old, though I'm not sure which is more dangerous: those things or 'rm -fR / &'.
     
  15. macrumors newbie

    Joined:
    Jul 20, 2011
    #15
    But it is already created for you.
    Why would you create it if it is already there?
    "cd /usr" and "cd /opt" is definitely simpler but "cd../..; cd usr; open ." and "cd ../..; cd opt; open ." was the first thing I thought of.
    Also, if you want the finder window with that folder showing, just add ";open .".
     
  16. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #16
    The OP wanted to know about /usr/local/bin, not /usr/opt/bin. /usr/local/bin is standard on Linux (other Unix's as well?).
     
  17. macrumors 68040

    Joined:
    Feb 2, 2008
    #17
    There's no such thing as a Linux standard. :) It's not standard UNIX since OS X conforms to the UNIX specification. There is a /usr/local which is for executables and and libraries not included by the basic OS.
     
  18. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #18
    I was about to counter with a quote from the Linux Filesystem Hierarchy Standard, but discovered it's not the Linux FHS but just the FHS. Unless your were being pedantic (rightly so?) about Linux the kernel verses Linux distros.
     
  19. macrumors 68040

    Joined:
    Feb 2, 2008
    #19
    My point was that someone could put together a Linux system without a /usr/local/bin and it would still be a Linux system, no? It could be anything using the Linux kernel, how many Linux distros are there? Just a couple of thousands or so. :) Don't worry though, I'm not being completely serious, it's just that Linux always struck me as kind of wild and uncontrolled.
     
  20. macrumors newbie

    Joined:
    Aug 31, 2011
  21. macrumors 6502a

    Joined:
    Jan 15, 2007
    #21
    Well I guess now we are getting into semantics, yes its not part of the unix standard, but it a unix convention. We were using /usr/local/bin on Irix machines in the late 80s/early 90s before Linux even existed :p
     
  22. macrumors 68040

    Joined:
    Feb 2, 2008
    #22
    Agreed, but it's a convention on OS X as well even though apparently that directory is not created by default on a clean OS install. :D
     
  23. macrumors newbie

    Joined:
    Feb 8, 2012
    #23
    I'm having some issues with OS X Lion and the usr/local/bin folder. Essentially it's not there and I keep getting permission denied errors when I try to create it in terminal. When I try to create it in a finder window it says the name is already taken. BUT, when I use the Go function and type in usr/local/bin it says the directory doesn't exist! This is very frustrating and makes no sense at all to my non-programmer brain. My other computer has this directory and it's running Lion....I'm guessing some program I installed must have created the directory for me on my other machine because I certainly did not create it.

    I'm trying to install blueutil on both machines and until I get the usr/local/bin folder accessible on this machine the install keeps failing saying the "directory /usr/local/bin does not exit (1) "

    If anyone can help I would be greatly appreciative.

    Thanks,

    Kevin
     
  24. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #24
    type the following in Terminal :

    Code:
    sudo mkdir /usr/local; sudo mkdir /usr/local/bin
    Anyway, any half decent installer should create directories when they don't exist. :confused:

    I dunno why people made such a long thread back in 2007 about something so simple. BTW : don't ressurect threads, start your own.

    Not to mention this isn't a programming question and does not belong in the programming forum.
     
  25. macrumors 68040

    Joined:
    Feb 2, 2008
    #25
    /usr/local should be present already. I would start by checking:

    Code:
    ls /usr/local/bin
    
    then, if not present.

    Code:
    mkdir /usr/local/bin
    
     

Share This Page