Where do I put new Terminal commands?

Discussion in 'OS X' started by Thrash911, Sep 26, 2008.

  1. macrumors 6502

    Thrash911

    Joined:
    Sep 14, 2006
    Location:
    Randers, DK
    #1
    I downloaded a new command to use in the terminal. I don't know where to put this.. Even if the command is at the same path the terminal is, it still can't find it. :confused:

    Where do I put it? And will the os need to "register" the command or something?
     
  2. macrumors member

    Joined:
    Sep 3, 2008
    Location:
    Frankfurt, Germany
    #2
    Could you be a little more specific please?

    What command did you download, and in which form did you download it - as disk image or as .pkg file?
     
  3. thread starter macrumors 6502

    Thrash911

    Joined:
    Sep 14, 2006
    Location:
    Randers, DK
    #3
    It's just a raw unix executable. It's "ipodpatcher" from here:

    http://www.rockbox.org/twiki/bin/view/Main/IpodPatcher

    I can double-click on it, and it executes in the terminal. But I have to use this command with some other parameters.. Is there a specific folder where I can put this, so the Terminal can always find it?
     
  4. isx
    macrumors member

    Joined:
    Sep 24, 2008
    #4
    use terminal to navigate (cd) to the folder containing the app. Then type the app name and any other switches you need to use. Should work fine.


     
  5. macrumors 6502a

    itickings

    Joined:
    Apr 14, 2007
    #5
    Depending on the setup, you may have to prefix the command with its path to make the terminal look in the right place.

    Code:
    cd /path/to/application
    ./command [parameters]
    or
    Code:
    /path/to/application/command [parameters]
    Edit: Regarding the OP's question, the command can be put anywhere. It will still be accessible if the place you put it in has been added to the PATH which tells the Terminal where to look for commands. OS X: Change your PATH environment variable
     
  6. macrumors newbie

    Joined:
    Feb 8, 2007
    #6
    If you will use the command a lot, you can copy it to you /usr/bin/ or /usr/sbin/ folder. Then you can run it just by typing in 'ipodpatcher' regardless of what directory you are in. You can copy it like this:
    Code:
    cp /path/to/ipodpatcher /usr/bin/ipodpatcher
    chmod 4755 /usr/bin/ipodpatcher
    The first line copies your binary to the /usr/bin/ folder and the second one changes the permissions of the file you just copied so it can be executed. I can't remember if either of those commands requires root permissions, but if you get an error about permission being denied, just prefix each of those lines above with 'sudo' and type in an administrator password when prompted.
     

Share This Page