I just made a .c file and compiled it with gcc in the terminal on OS X 10.8.2.
My syntax was gcc -o <filename> <sourcefile>
and that was fine. Now I see I have an executable and file <filename>
tells me as such, but I'm not sure how to actually run it beside double clicking the icon, /lame. When I try running the executable by just typing I get command not found, but I thought it was executable...?
Thank you.
EDIT: I"m so stupid, it was just open <filename>
I figured out that you can open them by opening TextEdit, then from the File dropdown menu select Open. Select the Unix executable file and it will open.
Unix will only run commands if they are available on the system path, as you can view by the $PATH variable
echo $PATH
Executables located in directories that are not on the path cannot be run unless you specify their full location. So in your case, assuming the executable is in the current directory you are working with, then you can execute it as such
./my-exec
Where my-exec
is the name of your program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With