How to install Tag?

Discussion in 'Mac Programming' started by nelly22, Jan 16, 2015.

  1. nelly22 macrumors 6502

    Joined:
    Sep 29, 2009
    #1
    I would like to use Tag.

    https://github.com/jdberry/tag

    I don't have MacPorts or Homebrew and i would prefer not to install these.

    Is there any way to install this without MacPorts or Homebrew? I have Xcode installed.

     
  2. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #2
    From the quote above, it seems so yes. Have you tried this?

     
  3. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #3
    I have never done this type of things. I presume if i type that to Terminal app, then it just works? Thanks
     
  4. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #4
    From the instructions, that's how it should work yes. You would only need to be in the same directory as the makefile as far as I can tell. I haven't attempted to install this however, but if all works as expected that's what should happen.
     
  5. nelly22, Jan 16, 2015
    Last edited by a moderator: Jan 16, 2015

    nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #5
    Thanks.

    I did this:

    Code:
    home:~ Nelly$ cd /Applications/Tag
    home:Tag Nelly$ make
    xcrun: error: active developer path ("/Volumes/BackUps/Applications/Xcode.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)
    At this point i opened Xcode and found out that preferences>Locations>Command Line Tools preference was empty so i clicked it and there was Xcode 6.1.1 so i selected it.

    Code:
    home:Tag Nelly$ make
    make: *** No targets specified and no makefile found.  Stop.
    I had wrong path so i changed it below twice:

    Code:
    home:Tag Nelly$ cd /Applications/Tag/tag-master/Tag
    home:Tag Nelly$ make
    make: *** No targets specified and no makefile found.  Stop.
    home:Tag Nelly$ cd /Applications/Tag/tag-master
    home:tag-master Nelly$ make && sudo make install
    mkdir -p bin
    cc  Tag/main.m Tag/Tag.m Tag/TagName.m -framework Foundation -framework CoreServices -o bin/tag
    
    WARNING: Improper use of the sudo command could lead to data loss
    or the deletion of important system files. Please double-check your
    typing when using sudo. Type "man sudo" for more information.
    
    To proceed, enter your password, or type Ctrl-C to abort.
    
    Password:
    /usr/bin/install -o root -g admin -m 0755 bin/tag /usr/local/bin
    home:tag-master Nelly$
    Now in /usr/local folder is "bin" which is Unix Executable File size 45 KB.

    According to Time Machine this is new file. I repaired persmissions and booted but it's still there.

    Tag works if i point to it this way: Applications/Tag/tag-master/bin/tag

    But i wonder if this bin (Unix Executable File) is okay or did i broke something, because instructions say "This will install tag at /usr/local/bin/tag" so that sounds like bin should be folder??

    If i want to put tag to correct folder which most likely is /usr/local/bin/, then how i do that?
     
  6. subsonix, Jan 16, 2015
    Last edited: Jan 16, 2015

    subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #6
    /usr/local/bin should be a directory, are you sure it's a file? You can try: file /usr/local/bin
    It should result in: /usr/local/bin: directory

    You should be able to just move it there manually, the only thing the make file does is compile the program and move it to /usr/local/bin. Did you have a /usr/local/bin directory previously? I mean have you added it yourself at some point?
     
  7. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #7
    Result is: Mach-O 64-bit executable x86_64

    Kind column in Finder: Unix Executable File
     
  8. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #8
    Right, it may be that this is tag, that got named bin. You can try:

    Code:
    shasum /Applications/Tag/tag-master/bin/tag
    shasum /usr/local/bin
    
    If that result in the same string, it is.
     
  9. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #9
    /usr/local/bin directory creation date is today and i didn't do it manually.

    You are correct both SHA codes are same, so it's tag.
     
  10. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #10
    Edit: Wait. Are you saying that /usr/local/bin is a directory or not?
     
  11. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #11
    Both SHA codes are same. So it must be tag, but it has black square icon with green "exec" text. It is not directory

    I just noticed that first i did "make" then after it "make && sudo make install". Dunno what's the difference.

    Maybe that is the problem because i did "make" twice.

    /bin/ folder don't have tag file.

    Like below instructions say, "make" installs to ./bin/tag and "make && sudo make install" installs to /usr/local/bin/tag. I opened ./bin/tag and it don't have tag.

     
  12. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #12
    Yes, but you said in the sentence above that the bin directory did not exist before, so I just wanted to make sure.

    Don't worry about it, all you need to do is rename /usr/local/bin to /usr/local/tag, create a bin directory and move it there. You can do this in Finder if you want, or:

    Code:
    mv /usr/local/bin /usr/local/tag
    mkdir /usr/local/bin
    mv /usr/local/tag /usr/local/bin/tag
    
    Since you did not have a bin directory before, also try: echo $PATH.
     
  13. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #13
    It works now!!

    I did move tag and rename it manually in Finder.

    Then typed "echo $PATH" to terminal. Result: /usr/local/bin: /usr/bin: /bin: /usr/sbin: /sbin:

    Only thing which still might be wrong is permissions of /usr/local/bin/ and /usr/local/bin/tag. Currently i can read and write. Maybe these should be owned by System?
     
  14. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #14
    Here's the problem. It's this command (the result of 'make install'):
    Code:
    /usr/bin/install -o root -g admin -m 0755 bin/tag /usr/local/bin
    
    If /usr/local/bin doesn't exist before this command executes, then the file (bin/tag) will be copied to a file named /usr/local/bin. The reason this happens is because this is exactly how /usr/bin/install works. Read the man page.

    Since /usr/local/bin doesn't exist by default on OS X, there is no directory to copy 'tag' into. The net result is that 'install' does its file1 file2 action, not its file1 ... fileN directory action.

    The best solution to this bug in the installation process is to use /usr/bin/install with the -d option to create the directory. This will also allow the use of the -u -g and -m options. It will have to be run with 'sudo' if the directory is to be owned by root.
     
  15. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #15
    Well, that has already been established.

    ----------

    You can try: stat -x on both of these, I think "tag" should be root, admin from the install step previously. But try it and see.
     
  16. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #16
    Thanks.

    So i should run this code to fix permissions?
     
  17. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #17
    No, you should establish what the current permissions, owner and group are.
     
  18. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #18
    You don't understand. That's the command you already executed. I copied it from what you posted in post #5. Search for bin/install on that page and you'll see it.

    I was simply explaining why that command (which you already executed) failed to do the right thing. It's because whoever made the makefile didn't take into account the possibility that /usr/local/bin didn't already exist.
     
  19. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #19
    /usr/local/bin: 0755/drwxr--xr-x Uid: 501/Nelly/wheel

    /usr/local/bin/tag: 0755/-rwxr--xr-x Uid: 501/Nelly/wheel
     
  20. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #20
    To change owner and group you can do this, to set it to root, admin like in the install step (not sure why that did not change).

    Code:
    sudo chown root:admin /usr/local/bin
    sudo chown root:admin /usr/local/bin/tag
    
     
  21. nelly22 thread starter macrumors 6502

    Joined:
    Sep 29, 2009
    #21
    Tons of thanks to both of you. Permissions look okay now. I tested it in Script Editor and it works as long i use do shell script "/usr/local/bin/tag" not just do shell script "tag".
     
  22. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #22
    That's odd, /usr/local/bin seemed to be in your $PATH variable.

     

Share This Page