How to create unix executable file..??

Discussion in 'OS X Mavericks (10.9)' started by Chi Tang, Jun 1, 2014.

  1. Chi Tang, Jun 1, 2014
    Last edited: Jun 1, 2014

    Chi Tang macrumors newbie

    Joined:
    Jun 1, 2014
    #1
    I'm trying to change a game file into a unix executable file using terminal and 'chmod +x' but it's giving me a message in terminal saying I do not have permission.

    I have full read and write permission for this file in my account so why can I not change it?

    Thanks..
     
  2. Chi Tang, Jun 1, 2014
    Last edited: Jun 1, 2014

    Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #2
    380 people read this request for help and not one offered a single suggestion.

    What's wrong with this world? :confused:
     
  3. blipmusic macrumors regular

    Joined:
    Feb 4, 2011
    #3
    "sudo chmod +x" perhaps? (enter your admin pass when prompted)
     
  4. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #4
    Thank you for the tip, I tried that but still getting 'permission denied'.
     
  5. chown33, Jun 1, 2014
    Last edited by a moderator: Jun 2, 2014

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Post the output of this:
    Code:
    ls -laO ; pwd ; id ; mount
    
    This will show:
    1. The lock, permissions, and ownership of the directory.
    2. The lock, permissions, and ownership of the file in question.
    3. What dir (and filesystem) the file resides on.
    4. What userid you're operating as.
    5. How the filesystem is mounted (if it's read-only, no amount of sudo or chmod magic will override that fact).

    When you post the output, be sure to identify exactly which file shown you want to be made executable.
     
  6. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #6
    Last login: Sun Jun 1 17:51:05 on ttys000
    Scraps-MacBook-Pro:~ scrap$ ls -laO ; pwd ; id ; mount
    total 96
    drwxr-xr-x+ 23 scrap staff - 782 27 May 12:34 .
    drwxr-xr-x 6 root admin - 204 27 May 09:32 ..
    -rw------- 1 scrap staff compressed 3 8 May 20:45 .CFUserTextEncoding
    -rw-r--r--@ 1 scrap staff - 43012 1 Jun 08:23 .DS_Store
    drwx------ 4 scrap staff - 136 1 Jun 18:16 .Trash
    -rw------- 1 scrap staff - 848 1 Jun 18:00 .bash_history
    drwxr-xr-x 4 scrap staff - 136 27 May 11:38 .config
    drwx------ 23 scrap staff - 782 1 Jun 16:49 .dropbox
    drwx------ 4 scrap staff - 136 29 May 15:52 .dropbox-master
    drwx------ 13 scrap staff - 442 1 Jun 17:38 .gnupg
    drwxr-xr-x 3 scrap staff - 102 13 May 18:08 .local
    drwx------ 4 scrap staff - 136 18 May 13:56 Applications
    drwx------+ 32 scrap staff - 1088 1 Jun 18:01 Desktop
    drwx------+ 13 scrap staff - 442 25 May 20:58 Documents
    drwx------+ 70 scrap staff - 2380 1 Jun 16:05 Downloads
    drwx------@ 14 scrap staff - 476 29 May 15:52 Dropbox
    drwx------@ 54 scrap staff hidden 1836 24 May 18:52 Library
    drwx------+ 5 scrap staff - 170 25 May 22:10 Movies
    drwx------+ 8 scrap staff - 272 1 Jun 07:08 Music
    drwx------+ 9 scrap staff - 306 26 May 13:37 Pictures
    drwxr-xr-x+ 5 scrap staff - 170 8 May 20:45 Public
    drwxr-xr-x 10 scrap staff - 340 1 Jun 13:29 Wine Files
    drwxr-xr-x 6 scrap staff - 204 25 May 21:51 dwhelper
    /Users/scrap
    uid=501(scrap) gid=20(staff) groups=20(staff),401(com.apple.sharepoint.group.1),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)
    /dev/disk0s2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    Scraps-MacBook-Pro:~ scrap$
     
  7. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #7
    Which is the file you're trying to run in OS X?
    There's nothing in that directory listing that's a file you'd try to run.
     
  8. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #8
    How can I show you the file?

    i can't run it or load it because it's the wrong format. It was a unix executable file but when I downloaded it it got converted to some plain format that i can't open. When I try to convert it back to a unix file I get the permission denied message in terminal.
     
  9. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #9
    What is it called? What folder/directory is it in? It's not in the folder/directory you listed.
    Also, just because the type is shown as Unix executable doesn't mean that it'll work on OS X.
     
  10. Chi Tang, Jun 1, 2014
    Last edited: Jun 1, 2014

    Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #10
    It's sitting on the desktop. It's needed so this game can run on Mac..
     
  11. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #11
    It does work on Mac.. I have been playing the game for a week now. But the executable got corrupted and caused the game to keep crashing. So I got someone to send me another copy of the exec file but it somehow got converted to a kind of nameless plaintext file.

    I just need to convert it back to it's original Unix executable form.

    That's where I'm stuck.
     
  12. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #12
    Agreed 100%.

    Many assumptions here. Just because it is sitting on your Mac doesn't mean that it can run on it. Who compiled it? which architecture? Which Unix OS? Just because you have it on your Mac doesn't mean that it was compiled on Solaris, Digital Unix, Linux, or any other unix-based architecture. You could be running into binary incompatibilities with the file.

    Second, who owns the file? Do you own the file? If not, you won't have permission to change it, because unless you are the superuser, you can not change permissions of a file you do not own.

    run "file <filename>" (where <filename> is the actual file you are wanting to change permissions on) to see what architecture it was built on.

    Come back with those, then we'll talk more.

    BL.
     
  13. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #13
    Sorry I don't understand what you mean by:

    Run "file <filename>" (where <filename>)

    All am told is that it came from the same game I am playing and that it's being played on a coputer the same as mine. But because it did not come zipped it's often the case the the format can change in transit.

    I'm in a similar situation to the one in this thread.

    http://forums.macrumors.com/showthread.php?t=770502
     
  14. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #14
    I can't see any of the pictures you linked to. They just show up in Safari as "missing image" icons.

    Since I can't see any pictures, I have no idea what "this game" means.

    When you say "similar situation" do you mean "World of Warcraft"? Or do you mean a different game that you're trying to patch?

    Being specific helps us help you.



    Post the output of this command:
    Code:
    ls -laO ~/Desktop ; file ~/Desktop/*
    
    Identify the file that needs to be executable.

    When I say "identify the file", I mean tell us which of the named files is the one of interest. I ask for this because you might have multiple files on your Desktop, and if you don't tell us its name, we can't tell you what command to use. If there's only one file on your Desktop, then the answer will be self-evident. But you've left out details before (like the fact it was on your Desktop), so I ask for this detail now so you won't leave it out.


    You could also ask whoever sent you the file to zip it (compress it) on their computer, then send you the zip file.
     
  15. ocabj macrumors 6502a

    ocabj

    Joined:
    Jul 2, 2009
    #15
    You should probably learn unix file permissions: http://en.wikipedia.org/wiki/Chmod

    Ever since I started using Linux in the mid-90s, I've always used octal.

    So if you have a file that needs to be executable in the unix context, then you need to ensure the first bit is set true for the given user/group/world owners as applicable.

    Generally, for something that needs to be executable by everyone using the system, chmod 755 <file> is acceptable, which gives read-write-execute to the user owner, read-execute for the group owner, and read-execute for the world.
     
  16. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #16
    Thank you Chown:

    Last login: Sun Jun 1 20:49:47 on ttys000
    Scraps-MacBook-Pro:~ scrap$ ls -laO ~/Desktop ; file ~/Desktop/*
    total 74080
    drwx------+ 17 scrap staff - 578 1 Jun 20:51 .
    drwxr-xr-x+ 23 scrap staff - 782 27 May 12:34 ..
    -rw-r--r--@ 1 scrap staff - 15364 1 Jun 20:52 .DS_Store
    -rw-r--r-- 1 scrap staff - 0 8 May 20:45 .localized
    -rw-r--r--@ 1 scrap staff - 617639 11 May 22:22 APPLICATIONS Screen Shot 2014-05-11 at 22.22.29.png
    -rw-r--r--@ 1 scrap staff - 17217 16 May 13:25 ATTYA-Roman-Numerals.gif
    -rw-r--r--@ 1 scrap staff - 17788 16 May 13:24 All the Things You Are Key Centers.gif
    drwxr-xr-x 10 scrap staff - 340 1 Jun 20:51 Box
    drwxr-xr-x 7 scrap staff - 238 1 Jun 20:50 E Books
    drwxr-xr-x 118 scrap staff - 4012 26 May 10:40 From Youtube
    drwx------ 5 scrap staff - 170 1 Jun 17:40 Old Firefox Data
    drwxr-xr-x 14 scrap staff - 476 1 Jun 18:01 RIP OFF
    drwxr-xr-x 71 scrap staff - 2414 1 Jun 20:51 Screenshots
    -rw-r--r--@ 1 scrap staff - 36628928 1 Jun 13:52 XCOM Enemy Unknown - Elite Edition
    -rw-r--r--@ 1 scrap staff - 180131 26 May 11:31 blog-05-26-2014(1).xml
    -rw-r--r--@ 1 scrap staff - 217379 26 May 11:29 blog-05-26-2014.xml
    -rw-r--r--@ 1 scrap staff - 213906 26 May 10:50 contacts.vcf


    It's the file in red.
     
  17. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #17
    Good, that tells me you own the file.

    But you didn't copy and paste the whole line I gave. I need to see the output of this:
    Code:
    file ~/Desktop/*
    
    The command to make the file executable will be this:
    Code:
    chmod a+x ~/Desktop/XCOM*
    
    Copy and paste exactly that into your Terminal window.

    Then copy and paste this:
    Code:
    ls -laO ~/Desktop
    
    Post the output of both commands. There shouldn't be any output from the 'chmod' command. The second 'ls' command should show 'x' permissions on the file.
     
  18. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #18
    Chown your a genius!!

    It's now executable! thank you so much sir! ;)

    Yes all I left off the desktop listing was a whole bunch of boring folders.

    I think I might be good now. So appreciated. Thank you all for your input and time.:D


    chmod a+x ~/Desktop/XCOM*Last login: Sun Jun 1 20:52:15 on ttys000

    Scraps-MacBook-Pro:~ scrap$ chmod a+x ~/Desktop/XCOM*
    Scraps-MacBook-Pro:~ scrap$ ls -laO ~/Desktop
    total 74080
    drwx------+ 17 scrap staff - 578 1 Jun 20:51 .
    drwxr-xr-x+ 23 scrap staff - 782 27 May 12:34 ..
    -rw-r--r--@ 1 scrap staff - 15364 1 Jun 20:52 .DS_Store
    -rw-r--r-- 1 scrap staff - 0 8 May 20:45 .localized
    -rw-r--r--@ 1 scrap staff - 617639 11 May 22:22 APPLICATIONS Screen Shot 2014-05-11 at 22.22.29.png
    -rw-r--r--@ 1 scrap staff - 17217 16 May 13:25 ATTYA-Roman-Numerals.gif
    -rw-r--r--@ 1 scrap staff - 17788 16 May 13:24 All the Things You Are Key Centers.gif
    drwxr-xr-x 10 scrap staff - 340 1 Jun 20:51 Box
    drwxr-xr-x 7 scrap staff - 238 1 Jun 20:50 E Books
    drwxr-xr-x 118 scrap staff - 4012 26 May 10:40 From Youtube
    drwx------ 5 scrap staff - 170 1 Jun 17:40 Old Firefox Data
    drwxr-xr-x 14 scrap staff - 476 1 Jun 18:01 RIP OFF
    drwxr-xr-x 71 scrap staff - 2414 1 Jun 20:51 Screenshots
    -rwxr-xr-x@ 1 scrap staff - 36628928 1 Jun 13:52 XCOM Enemy Unknown - Elite Edition
    -rw-r--r--@ 1 scrap staff - 180131 26 May 11:31 blog-05-26-2014(1).xml
    -rw-r--r--@ 1 scrap staff - 217379 26 May 11:29 blog-05-26-2014.xml
    -rw-r--r--@ 1 scrap staff - 213906 26 May 10:50 contacts.vcf
    Scraps-MacBook-Pro:~ scrap$
     
  19. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #19
    Game is playing perfectly now after replaing the old exutable file with the new one. Cheers!!

    ;)
     
  20. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #20
    Glad you got it working.

    For future reference, when you say that some command doesn't work, post the complete command, exactly as you entered it. The simplest and most accurate way to do this is to select the command and its output in the Terminal window, Copy it to the clipboard (⌘C), then paste the entire text into a post here.

    Posting exactly what you entered lets us see both the cause (the command) and the result (an error message) of the intended action. If all you do is post 'chmod +x' without the name of the file being targeted, we have no way to know what you're actually telling the command to do.


    "A whole bunch of boring folders" to you are informative details to me.


    In short, details are important. Copy and paste is the most accurate way to preserve all details.
     
  21. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
  22. Nermal Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #22
    Absolutely. Just yesterday I was trying to help a friend with something. When he got an error message he didn't tell me the text of the error but rather that "it did nothing". I was completely stumped by why the command was (supposedly) returning no output whatsoever...

    And, of course, the whole problem was due to him not entering/copying the command verbatim :)
     
  23. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014
    #23
    I do recall stating in the very first post this:

    I have full read and write permission for this file in my account so why can I not change it?

    So I did not say the command did nothing.. I mentioned that Terminal came back with a message that I 'do not have permission' to change the files attribute with that particular command. I did not know I was missing half the command.

    Point taken though.. the need for being very specific and accurate can not be overstated. :)
     
  24. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #24
    Another thing that will help you, especially if you are wanting to deal with things at the filesystem level: RTFM.

    By default, every Unix OS should come with manual pages installed for a given command. If you don't know or understand what a command is or does, read the manual page on it. For example, you didn't understand what the file command did. If you ran:

    Code:
    man file
    
    at the command prompt, you would be presented with the manual page for the file command. Read that, see what it does, then you should have a better understanding on what the command does.

    BL.
     
  25. Chi Tang thread starter macrumors newbie

    Joined:
    Jun 1, 2014

Share This Page